Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Sortable Grid

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: User:Kbwiki (09 Nov 2009)
Last edited: hamishwillee (31 Jul 2012)

Contents

Inheritance

Nokia.Sortable
| - Nokia.Widget
|- Nokia.Class (basic class)

1 - Description

This component is a content organiser that enables the user to sort the items it contains.


2 - Visual Design

Sortable-grid01.png

3 - Component Dependencies

3.1 CSS

<!-- Themeroller CSS -->
<link rel="stylesheet" href="themes/themeroller/<theme>/Themeroller.css" type="text/css" media="screen">
<!-- Specific Theme/Resolution CSS -->
<link rel="stylesheet" href="/themes/nokia/ext-theme/<theme>/<resolution>/custom.css" type="text/css" media="screen">


3.2 Javascript

<!-- jQuery file -->
<script src="/lib/jquery/jQuery.js" type="text/javascript" charset="utf-8"></script>
<!-- Guarana file -->
<script src="/lib/Guarana.js" type="text/javascript" charset="utf-8"></script>

4 - Functional Specifications/Requirements

4.1 - Options

  • element: 'selector'
    • jQuery selector or the DOM reference to become the container of the component.
  • items[]: string
    • Defines the list of sortable grid items.
  • selectedClass: Object
    • Defines the CSS class when the component is in selected mode.
  • resetInterval: int
    • Defines resetInterval, used in component animation.


4.2 - Events - Callbacks

  • create: function()
    • Scope: [this.element]
  • select: function(event, originalItem, targetItem)
    • Scope: [this.element]
  • change: function(event, originalItem, targetItem)
    • Scope: [this.element]
  • reset: function(event)
    • Scope: [this.element]

4.3 - Methods

  • select: function(item, event)
    • Selects a component item.
    • return [void]
  • getSelectedElements: function()
    • Returns the set of selected elements.
    • return [jQuery collection]
  • clear: function(item)
    • Clears component elements.
    • return [void]
  • changePosition: function(event)
    • Changes the position of selected elements.
    • return [void]


4.4 - Default options

  • items: '> div',
  • selectedClass: 'selected',
  • resetInterval: 300



5 - Component Demo

5.1 HTML

In this demo we will apply the sortable component for the html bellow, but sortable can be applied for any html.


 <style type="text/css" media="screen">
     #container1 {
          width: 340px;
          height: 640px;
          background: #efefef;
     }

     #container1 div {
          width: 105px;
          height: 105px;
          line-height: 50px;
          float: left;
     }

     #container1 div, #container2 div {
          text-align: center;
          font-size: 20px;
          margin: 3px;
     }
 </style>
 

 

<div id="container1">
     <div class="ui-widget-header ui-state-default"> 1 </div>
     <div class="ui-widget-header ui-state-default"> 2 </div>
     <div class="ui-widget-header ui-state-default"> 3 </div>
     <div class="ui-widget-header ui-state-default"> 4 </div>
     <div class="ui-widget-header ui-state-default"> 5 </div>
     <div class="ui-widget-header ui-state-default"> 6 </div>
     <div class="ui-widget-header ui-state-default"> 7 </div>
     <div class="ui-widget-header ui-state-default"> 8 </div>
     <div class="ui-widget-header ui-state-default"> 9 </div>
</div>

5.2 Javascript

var sortable1 = new Nokia.Sortable({ 
     element: '#container1', 
     items: '> div', 
     selectedClass: 'ui-state-active', 
     create: function() { 
          //alert("Sortable: Create"); 
     }, 
     select: function(event, originalItem, targetItem) { 
          //alert('Sortable: Select');
     }, 
     change: function(event, originalItem, targetItem) { 
          //alert('Sortable: Change'); 
     }, 
     reset: function(event) { 
          //alert('Sortable: Reset'); 
     } 
});

6 - Nokia WRT Browser Compatibility

 

▴   S60 3.1 S60 3.2 S60 5.0
Sortable Grid YES YES  YES 

 

This page was last modified on 31 July 2012, at 10:49.
65 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×