Changeset 13168

Show
Ignore:
Timestamp:
03/21/08 05:37:30 (10 months ago)
Author:
wolfram
Message:

+ committing jaredj patch, thx. Make QueryReadStore? automatically handle "sorting" (as set by the grid) fixes #5843
+ simplify the according examples
+ add grid example
+ fix some CS issues

Location:
dojox/trunk/data
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • dojox/trunk/data/QueryReadStore.js

    r13008 r13168  
    33dojo.require("dojo.string"); 
    44 
    5 dojo.declare("dojox.data.QueryReadStore", null, { 
    6         /* 
     5dojo.declare("dojox.data.QueryReadStore", 
     6        null, 
     7        { 
    78        //      summary: 
    89        //              This class provides a store that is mainly intended to be used 
     
    1617        //              letters "ac" it returns only items like "action", "acting", etc. 
    1718        // 
    18         //  note: 
    19         //      The field name "id" in a query is reserved for looking up data 
    20         //      by id. This is necessary as before the first fetch, the store 
    21         //      has no way of knowing which field the server will declare as 
    22         //      identifier. 
     19        // note: 
     20        //              The field name "id" in a query is reserved for looking up data 
     21        //              by id. This is necessary as before the first fetch, the store 
     22        //              has no way of knowing which field the server will declare as 
     23        //              identifier. 
    2324        // 
    2425        //      examples: 
    25         //              // The parameter "query" contains the data that are sent to the server. 
    26         //              var store = new dojox.data.QueryReadStore({url:'/search.php'}); 
    27         //              store.fetch({query:{name:'a'}, queryOptions:{ignoreCase:false}}); 
     26        // |    // The parameter "query" contains the data that are sent to the server. 
     27        // |    var store = new dojox.data.QueryReadStore({url:'/search.php'}); 
     28        // |    store.fetch({query:{name:'a'}, queryOptions:{ignoreCase:false}}); 
    2829        // 
    29         //              // Since "serverQuery" is given, it overrules and those data are 
    30         //              // sent to the server. 
    31         //              var store = new dojox.data.QueryReadStore({url:'/search.php'}); 
    32         //              store.fetch({serverQuery:{name:'a'}, queryOptions:{ignoreCase:false}}); 
     30        // |    // Since "serverQuery" is given, it overrules and those data are 
     31        // |    // sent to the server. 
     32        // |    var store = new dojox.data.QueryReadStore({url:'/search.php'}); 
     33        // |    store.fetch({serverQuery:{name:'a'}, queryOptions:{ignoreCase:false}}); 
     34        // 
     35        // |    <div dojoType="dojox.data.QueryReadStore" 
     36        // |            jsId="store2" 
     37        // |            url="../tests/stores/QueryReadStore.php" 
     38        // |            requestMethod="post"></div> 
     39        // |    <div dojoType="dojox.grid.data.DojoData" 
     40        // |            jsId="model2" 
     41        // |            store="store2" 
     42        // |            sortFields="[{attribute: 'name', descending: true}]" 
     43        // |            rowsPerPage="30"></div> 
     44        // |    <div dojoType="dojox.Grid" id="grid2" 
     45        // |            model="model2" 
     46        // |            structure="gridLayout" 
     47        // |            style="height:300px; width:800px;"></div> 
     48 
    3349        // 
    3450        //      todo: 
    3551        //              - there is a bug in the paging, when i set start:2, count:5 after an initial fetch() and doClientPaging:true 
    3652        //                it returns 6 elemetns, though count=5, try it in QueryReadStore.html 
    37         //              - allow configuring if the paging shall takes place on the client or the server 
    3853        //              - add optional caching 
    3954        //              - when the first query searched for "a" and the next for a subset of 
     
    4156        //                we have client paging, we just need to filter the items we already have 
    4257        //                that might also be tooo much logic 
    43         */ 
    4458         
    4559        url:"", 
     
    7084        lastRequestHash:null, 
    7185         
    72         // If this is false, every request is sent to the server. 
    73         // If it's true a second request with the same query will not issue another 
    74         // request, but use the already returned data. This assumes that the server 
    75         // does not do the paging. 
    76         doClientPaging:true, 
     86        // summary: 
     87        //              By default every request for paging is sent to the server. 
     88        doClientPaging:false, 
     89 
     90        // summary: 
     91        //              By default all the sorting is done serverside before the data is returned 
     92        //              which is the proper place to be doing it for really large datasets. 
     93        doClientSorting:false, 
    7794 
    7895        // Items by identify for Identify API 
     
    226243                                requestObject.onBegin.call(scope, numRows, requestObject); 
    227244                        } 
    228                         if(requestObject.sort){ 
     245                        if(requestObject.sort && this.doClientSorting){ 
    229246                                items.sort(dojo.data.util.sorter.createSortFunction(requestObject.sort, self)); 
    230247                        } 
     
    273290                } 
    274291                return null; //null 
    275         }, 
     292        }, 
    276293         
    277294        _fetchItems: function(request, fetchHandler, errorHandler){ 
     
    311328                        if (request.count) { 
    312329                                serverQuery.count = request.count; 
     330                        } 
     331                } 
     332                if(!this.doClientSorting){ 
     333                        if(request.sort){ 
     334                                var sort = request.sort[0]; 
     335                                if(sort && sort.attribute){ 
     336                                        var sortStr = sort.attribute; 
     337                                        if(sort.descending){ 
     338                                                sortStr = "-" + sortStr; 
     339                                        } 
     340                                        serverQuery.sort = sortStr; 
     341                                } 
    313342                        } 
    314343                } 
     
    477506                return [this._identifier]; 
    478507        } 
    479 }); 
     508} 
     509); 
  • dojox/trunk/data/tests/QueryReadStore.html

    r11508 r13168  
    127127        This ComboBox uses a customized QueryReadStore, it prepares the query-string for the URL that 
    128128        way that the paging parameters "start" and "count" are also send.<br /> 
    129         <div dojoType="ServerPagingReadStore" jsId="serverPagingStore" url="stores/QueryReadStore.php" requestMethod="get" doClientPaging="false"></div> 
     129        <div dojoType="ServerPagingReadStore" jsId="serverPagingStore" url="stores/QueryReadStore.php" requestMethod="get"></div> 
    130130        <input dojoType="dijit.form.ComboBox" store="serverPagingStore" pageSize="5" /> 
    131131        <br /> 
    132132        <a href="javascript://" onclick="var d = dojo.byId('pagingCode'); d.style.display= d.style.display=='none'?'block':'none';">Click here to  see the code!</a> 
    133133<div id="pagingCode" style="display:none;"> 
    134         The HTML might look like this, the important attribute: <em>doClientPaging="false"</em> this takes care that the same query is fired to the server 
    135         and its not assumed that the client (the store) does the paging on the old data. 
     134        The HTML might look like this. 
    136135        <pre> 
    137 &lt;div dojoType="ServerPagingReadStore" jsId="serverPagingStore" url="stores/QueryReadStore.php" requestMethod="get" doClientPaging="false"&gt;&lt;/div&gt; 
     136&lt;div dojoType="ServerPagingReadStore" jsId="serverPagingStore" url="stores/QueryReadStore.php" requestMethod="get"&gt;&lt;/div&gt; 
    138137&lt;input dojoType="dijit.form.ComboBox" store="serverPagingStore" pageSize="10" /&gt; 
    139138        </pre> 
  • dojox/trunk/data/tests/stores/QueryReadStore.js

    r13008 r13168  
    77dojox.data.tests.stores.QueryReadStore.getStore = function(){ 
    88        return new dojox.data.QueryReadStore({ 
    9                         url: dojo.moduleUrl("dojox.data.tests", "stores/QueryReadStore.php").toString(), 
    10                         doClientPaging:true // "true" is actually also the default, but make sure :-). 
     9                        url: dojo.moduleUrl("dojox.data.tests", "stores/QueryReadStore.php").toString() 
    1110                }); 
    1211}; 
     
    9493                                var item = items[0]; 
    9594                                // The good case(s). 
    96                                 t.assertEqual(['id', 'name', 'label', 'abbreviation'], store.getAttributes(item)); 
     95                                t.assertEqual(['id', 'name', 'label', 'abbreviation', 'capital'], store.getAttributes(item)); 
    9796                                t.assertError(Error, store, "getAttributes", [{}]); 
    9897                                 
     
    215214                                d.errback(error); 
    216215                        } 
    217                         store.fetch({query:{q:"a"}, onComplete: onComplete, onError: onError}); 
     216                        store.fetch({query:{q:"m"}, onComplete: onComplete, onError: onError}); 
    218217                        return d; //Object 
    219218                }, 
     
    233232                        } 
    234233                        function onComplete(items, request) { 
    235                                 t.assertEqual(3, items.length); 
     234                                t.assertEqual(5, items.length); 
    236235                                if(passed){ 
    237                     d.callback(true); 
     236                                        d.callback(true); 
    238237                                }else{ 
    239238                                        d.errback(new Error("Store did not return proper number of rows, regardless of page size")); 
     
    243242                                d.errback(error); 
    244243                        } 
    245                         store.fetch({query:{q:"a"}, start: 5, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
     244                        store.fetch({query:{q:"m"}, start: 0, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
    246245                        return d; //Object 
    247246                }, 
     
    263262                                t.assertEqual(3, items.length); 
    264263                                if(passed){ 
    265                     d.callback(true); 
     264                                        d.callback(true); 
    266265                                }else{ 
    267266                                        d.errback(new Error("Store did not return proper number of rows, regardless of page size")); 
     
    271270                                d.errback(error); 
    272271                        } 
    273             store.doClientPaging = false; 
    274                         store.fetch({query:{q:"a"}, start: 5, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
     272                        store.fetch({query:{q:"m"}, start: 5, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
    275273                        return d; //Object 
    276274                }, 
     
    282280                        //              Simple test of fetching items, checking that onBegin size is all items matched, and page is just the items asked for. 
    283281                        var store = dojox.data.tests.stores.QueryReadStore.getStore(); 
     282                        store.doClientPaging = true; 
    284283 
    285284                        var d = new doh.Deferred(); 
     
    290289                        } 
    291290                        function onComplete(items, request) { 
    292                                 t.assertEqual(3, items.length); 
     291                                t.assertEqual(5, items.length); 
    293292                                if(passed){ 
    294                     d.callback(true); 
     293                                        d.callback(true); 
    295294                                }else{ 
    296295                                        d.errback(new Error("Store did not return proper number of rows, regardless of page size")); 
     
    300299                                d.errback(error); 
    301300                        } 
    302                         store.fetch({query:{q:"a"}, start: 5, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
     301                        store.fetch({query:{q:"m"}, start: 0, count: 5, onBegin: onBegin, onComplete: onComplete, onError: onError}); 
    303302                        return d; //Object 
    304303                }, 
     
    327326                        //      description: 
    328327                        var store = dojox.data.tests.stores.QueryReadStore.getStore(); 
     328                        store.doClientPaging = true; 
    329329 
    330330                        var lastRequestHash = null; 
     
    351351                                d.errback(error); 
    352352                        } 
    353                         var req = {query:{q:"a"}, start:0, count:5, 
     353                        var req = {query:{q:"m"}, start:0, count:5, 
    354354                                                onComplete: onComplete, onError: onError}; 
    355355                        store.fetch(req); 
  • dojox/trunk/data/tests/stores/QueryReadStore.php

    r12479 r13168  
    44 
    55$allItems = array( 
    6         array('id'=>0, 'name'=>"Alabama", 'label'=>"<img src='images/Alabama.jpg'/>Alabama", 'abbreviation'=>"AL"), 
    7         array('id'=>1, 'name'=>"Alaska", 'label'=>"Alaska", 'abbreviation'=>"AK"), 
    8         array('id'=>2, 'name'=>"American Samoa", 'label'=>"American Samoa", 'abbreviation'=>"AS"), 
    9         array('id'=>3, 'name'=>"Arizona", 'label'=>"Arizona", 'abbreviation'=>"AZ"), 
    10         array('id'=>4, 'name'=>"Arkansas", 'label'=>"Arkansas", 'abbreviation'=>"AR"), 
    11         array('id'=>5, 'name'=>"Armed Forces Europe", 'label'=>"Armed Forces Europe", 'abbreviation'=>"AE"), 
    12         array('id'=>6, 'name'=>"Armed Forces Pacific", 'label'=>"Armed Forces Pacific", 'abbreviation'=>"AP"), 
    13         array('id'=>7, 'name'=>"Armed Forces the Americas", 'label'=>"Armed Forces the Americas", 'abbreviation'=>"AA"), 
    14         array('id'=>8, 'name'=>"California", 'label'=>"California", 'abbreviation'=>"CA"), 
    15         array('id'=>9, 'name'=>"Colorado", 'label'=>"Colorado", 'abbreviation'=>"CO"), 
    16         array('id'=>10, 'name'=>"Connecticut", 'label'=>"Connecticut", 'abbreviation'=>"CT"), 
    17         array('id'=>11, 'name'=>"Delaware", 'label'=>"Delaware", 'abbreviation'=>"DE"), 
    18         array('id'=>12, 'name'=>"District of Columbia", 'label'=>"District of Columbia", 'abbreviation'=>"DC"), 
    19         array('id'=>13, 'name'=>"Federated States of Micronesia", 'label'=>"Federated States of Micronesia", 'abbreviation'=>"FM"), 
    20         array('id'=>14, 'name'=>"Florida", 'label'=>"Florida", 'abbreviation'=>"FL"), 
    21         array('id'=>15, 'name'=>"Georgia", 'label'=>"Georgia", 'abbreviation'=>"GA"), 
    22         array('id'=>16, 'name'=>"Guam", 'label'=>"Guam", 'abbreviation'=>"GU"), 
    23         array('id'=>17, 'name'=>"Hawaii", 'label'=>"Hawaii", 'abbreviation'=>"HI"), 
    24         array('id'=>18, 'name'=>"Idaho", 'label'=>"Idaho", 'abbreviation'=>"ID"), 
    25         array('id'=>19, 'name'=>"Illinois", 'label'=>"Illinois", 'abbreviation'=>"IL"), 
    26         array('id'=>20, 'name'=>"Indiana", 'label'=>"Indiana", 'abbreviation'=>"IN"), 
    27         array('id'=>21, 'name'=>"Iowa", 'label'=>"Iowa", 'abbreviation'=>"IA"), 
    28         array('id'=>22, 'name'=>"Kansas", 'label'=>"Kansas", 'abbreviation'=>"KS"), 
    29         array('id'=>23, 'name'=>"Kentucky", 'label'=>"Kentucky", 'abbreviation'=>"KY"), 
    30         array('id'=>24, 'name'=>"Louisiana", 'label'=>"Louisiana", 'abbreviation'=>"LA"), 
    31         array('id'=>25, 'name'=>"Maine", 'label'=>"Maine", 'abbreviation'=>"ME"), 
    32         array('id'=>26, 'name'=>"Marshall Islands", 'label'=>"Marshall Islands", 'abbreviation'=>"MH"), 
    33         array('id'=>27, 'name'=>"Maryland", 'label'=>"Maryland", 'abbreviation'=>"MD"), 
    34         array('id'=>28, 'name'=>"Massachusetts", 'label'=>"Massachusetts", 'abbreviation'=>"MA"), 
    35         array('id'=>29, 'name'=>"Michigan", 'label'=>"Michigan", 'abbreviation'=>"MI"), 
    36         array('id'=>30, 'name'=>"Minnesota", 'label'=>"Minnesota", 'abbreviation'=>"MN"), 
    37         array('id'=>31, 'name'=>"Mississippi", 'label'=>"Mississippi", 'abbreviation'=>"MS"), 
    38         array('id'=>32, 'name'=>"Missouri", 'label'=>"Missouri", 'abbreviation'=>"MO"), 
    39         array('id'=>33, 'name'=>"Montana", 'label'=>"Montana", 'abbreviation'=>"MT"), 
    40         array('id'=>34, 'name'=>"Nebraska", 'label'=>"Nebraska", 'abbreviation'=>"NE"), 
    41         array('id'=>35, 'name'=>"Nevada", 'label'=>"Nevada", 'abbreviation'=>"NV"), 
    42         array('id'=>36, 'name'=>"New Hampshire", 'label'=>"New Hampshire", 'abbreviation'=>"NH"), 
    43         array('id'=>37, 'name'=>"New Jersey", 'label'=>"New Jersey", 'abbreviation'=>"NJ"), 
    44         array('id'=>38, 'name'=>"New Mexico", 'label'=>"New Mexico", 'abbreviation'=>"NM"), 
    45         array('id'=>39, 'name'=>"New York", 'label'=>"New York", 'abbreviation'=>"NY"), 
    46         array('id'=>40, 'name'=>"North Carolina", 'label'=>"North Carolina", 'abbreviation'=>"NC"), 
    47         array('id'=>41, 'name'=>"North Dakota", 'label'=>"North Dakota", 'abbreviation'=>"ND"), 
    48         array('id'=>42, 'name'=>"Northern Mariana Islands", 'label'=>"Northern Mariana Islands", 'abbreviation'=>"MP"), 
    49         array('id'=>43, 'name'=>"Ohio", 'label'=>"Ohio", 'abbreviation'=>"OH"), 
    50         array('id'=>44, 'name'=>"Oklahoma", 'label'=>"Oklahoma", 'abbreviation'=>"OK"), 
    51         array('id'=>45, 'name'=>"Oregon", 'label'=>"Oregon", 'abbreviation'=>"OR"), 
    52         array('id'=>46, 'name'=>"Pennsylvania", 'label'=>"Pennsylvania", 'abbreviation'=>"PA"), 
    53         array('id'=>47, 'name'=>"Puerto Rico", 'label'=>"Puerto Rico", 'abbreviation'=>"PR"), 
    54         array('id'=>48, 'name'=>"Rhode Island", 'label'=>"Rhode Island", 'abbreviation'=>"RI"), 
    55         array('id'=>49, 'name'=>"South Carolina", 'label'=>"South Carolina", 'abbreviation'=>"SC"), 
    56         array('id'=>50, 'name'=>"South Dakota", 'label'=>"South Dakota", 'abbreviation'=>"SD"), 
    57         array('id'=>51, 'name'=>"Tennessee", 'label'=>"Tennessee", 'abbreviation'=>"TN"), 
    58         array('id'=>52, 'name'=>"Texas", 'label'=>"Texas", 'abbreviation'=>"TX"), 
    59         array('id'=>53, 'name'=>"Utah", 'label'=>"Utah", 'abbreviation'=>"UT"), 
    60         array('id'=>54, 'name'=>"Vermont", 'label'=>"Vermont", 'abbreviation'=>"VT"), 
    61         array('id'=>55, 'name'=> "Virgin Islands, U.S.", 'label'=>"Virgin Islands, U.S.", 'abbreviation'=>"VI"), 
    62         array('id'=>56, 'name'=>"Virginia", 'label'=>"Virginia", 'abbreviation'=>"VA"), 
    63         array('id'=>57, 'name'=>"Washington", 'label'=>"Washington", 'abbreviation'=>"WA"), 
    64         array('id'=>58, 'name'=>"West Virginia", 'label'=>"West Virginia", 'abbreviation'=>"WV"), 
    65         array('id'=>59, 'name'=>"Wisconsin", 'label'=>"Wisconsin", 'abbreviation'=>"WI"), 
    66         array('id'=>60, 'name'=>"Wyoming", 'label'=>"Wyoming", 'abbreviation'=>"WY"), 
     6        array('id'=>0, 'name'=>"Alabama", 'label'=>"<img src='images/Alabama.jpg'/>Alabama", 'abbreviation'=>"AL", 'capital'=>'Montgomery'), 
     7        array('id'=>1, 'name'=>"Alaska", 'label'=>"Alaska", 'abbreviation'=>"AK", 'capital'=>'Juneau'), 
     8        //array('id'=>2, 'name'=>"American Samoa", 'label'=>"American Samoa", 'abbreviation'=>"AS", 'capital'=>''), 
     9        array('id'=>3, 'name'=>"Arizona", 'label'=>"Arizona", 'abbreviation'=>"AZ", 'capital'=>'Phoenix'), 
     10        array('id'=>4, 'name'=>"Arkansas", 'label'=>"Arkansas", 'abbreviation'=>"AR", 'capital'=>'Little Rock'), 
     11        //array('id'=>5, 'name'=>"Armed Forces Europe", 'label'=>"Armed Forces Europe", 'abbreviation'=>"AE", 'capital'=>''), 
     12        //array('id'=>6, 'name'=>"Armed Forces Pacific", 'label'=>"Armed Forces Pacific", 'abbreviation'=>"AP", 'capital'=>''), 
     13        //array('id'=>7, 'name'=>"Armed Forces the Americas", 'label'=>"Armed Forces the Americas", 'abbreviation'=>"AA", 'capital'=>''), 
     14        array('id'=>8, 'name'=>"California", 'label'=>"California", 'abbreviation'=>"CA", 'capital'=>'Sacramento'), 
     15        array('id'=>9, 'name'=>"Colorado", 'label'=>"Colorado", 'abbreviation'=>"CO", 'capital'=>'Denver'), 
     16        array('id'=>10, 'name'=>"Connecticut", 'label'=>"Connecticut", 'abbreviation'=>"CT", 'capital'=>'Hartford'), 
     17        array('id'=>11, 'name'=>"Delaware", 'label'=>"Delaware", 'abbreviation'=>"DE", 'capital'=>'Dover'), 
     18        //array('id'=>12, 'name'=>"District of Columbia", 'label'=>"District of Columbia", 'abbreviation'=>"DC", 'capital'=>''), 
     19        //array('id'=>13, 'name'=>"Federated States of Micronesia", 'label'=>"Federated States of Micronesia", 'abbreviation'=>"FM", 'capital'=>''), 
     20        array('id'=>14, 'name'=>"Florida", 'label'=>"Florida", 'abbreviation'=>"FL", 'capital'=>'Tallahassee'), 
     21        array('id'=>15, 'name'=>"Georgia", 'label'=>"Georgia", 'abbreviation'=>"GA", 'capital'=>'Atlanta'), 
     22        //array('id'=>16, 'name'=>"Guam", 'label'=>"Guam", 'abbreviation'=>"GU", 'capital'=>''), 
     23        array('id'=>17, 'name'=>"Hawaii", 'label'=>"Hawaii", 'abbreviation'=>"HI", 'capital'=>'Honolulu'), 
     24        array('id'=>18, 'name'=>"Idaho", 'label'=>"Idaho", 'abbreviation'=>"ID", 'capital'=>'Boise'), 
     25        array('id'=>19, 'name'=>"Illinois", 'label'=>"Illinois", 'abbreviation'=>"IL", 'capital'=>'Springfield'), 
     26        array('id'=>20, 'name'=>"Indiana", 'label'=>"Indiana", 'abbreviation'=>"IN", 'capital'=>'Indianapolis'), 
     27        array('id'=>21, 'name'=>"Iowa", 'label'=>"Iowa", 'abbreviation'=>"IA", 'capital'=>'Des Moines'), 
     28        array('id'=>22, 'name'=>"Kansas", 'label'=>"Kansas", 'abbreviation'=>"KS", 'capital'=>'Topeka'), 
     29        array('id'=>23, 'name'=>"Kentucky", 'label'=>"Kentucky", 'abbreviation'=>"KY", 'capital'=>'Frankfort'), 
     30        array('id'=>24, 'name'=>"Louisiana", 'label'=>"Louisiana", 'abbreviation'=>"LA", 'capital'=>'Baton Rouge'), 
     31        array('id'=>25, 'name'=>"Maine", 'label'=>"Maine", 'abbreviation'=>"ME", 'capital'=>'Augusta'), 
     32        //array('id'=>26, 'name'=>"Marshall Islands", 'label'=>"Marshall Islands", 'abbreviation'=>"MH", 'capital'=>''), 
     33        array('id'=>27, 'name'=>"Maryland", 'label'=>"Maryland", 'abbreviation'=>"MD", 'capital'=>'Annapolis'), 
     34        array('id'=>28, 'name'=>"Massachusetts", 'label'=>"Massachusetts", 'abbreviation'=>"MA", 'capital'=>'Boston'), 
     35        array('id'=>29, 'name'=>"Michigan", 'label'=>"Michigan", 'abbreviation'=>"MI", 'capital'=>'Lansing'), 
     36        array('id'=>30, 'name'=>"Minnesota", 'label'=>"Minnesota", 'abbreviation'=>"MN", 'capital'=>'Saint Paul'), 
     37        array('id'=>31, 'name'=>"Mississippi", 'label'=>"Mississippi", 'abbreviation'=>"MS", 'capital'=>'Jackson'), 
     38        array('id'=>32, 'name'=>"Missouri", 'label'=>"Missouri", 'abbreviation'=>"MO", 'capital'=>'Jefferson City'), 
     39        array('id'=>33, 'name'=>"Montana", 'label'=>"Montana", 'abbreviation'=>"MT", 'capital'=>'Helena'), 
     40        array('id'=>34, 'name'=>"Nebraska", 'label'=>"Nebraska", 'abbreviation'=>"NE", 'capital'=>'Lincoln'), 
     41        array('id'=>35, 'name'=>"Nevada", 'label'=>"Nevada", 'abbreviation'=>"NV", 'capital'=>'Carson City'), 
     42        array('id'=>36, 'name'=>"New Hampshire", 'label'=>"New Hampshire", 'abbreviation'=>"NH", 'capital'=>'Concord'), 
     43        array('id'=>37, 'name'=>"New Jersey", 'label'=>"New Jersey", 'abbreviation'=>"NJ", 'capital'=>'Trenton'), 
     44        array('id'=>38, 'name'=>"New Mexico", 'label'=>"New Mexico", 'abbreviation'=>"NM", 'capital'=>'Santa Fe'), 
     45        array('id'=>39, 'name'=>"New York", 'label'=>"New York", 'abbreviation'=>"NY", 'capital'=>'Albany'), 
     46        array('id'=>40, 'name'=>"North Carolina", 'label'=>"North Carolina", 'abbreviation'=>"NC", 'capital'=>'Raleigh'), 
     47        array('id'=>41, 'name'=>"North Dakota", 'label'=>"North Dakota", 'abbreviation'=>"ND", 'capital'=>'Bismarck'), 
     48        //array('id'=>42, 'name'=>"Northern Mariana Islands", 'label'=>"Northern Mariana Islands", 'abbreviation'=>"MP", 'capital'=>''), 
     49        array('id'=>43, 'name'=>"Ohio", 'label'=>"Ohio", 'abbreviation'=>"OH", 'capital'=>'Columbus'), 
     50        array('id'=>44, 'name'=>"Oklahoma", 'label'=>"Oklahoma", 'abbreviation'=>"OK", 'capital'=>'Oklahoma City'), 
     51        array('id'=>45, 'name'=>"Oregon", 'label'=>"Oregon", 'abbreviation'=>"OR", 'capital'=>'Salem'), 
     52        array('id'=>46, 'name'=>"Pennsylvania", 'label'=>"Pennsylvania", 'abbreviation'=>"PA", 'capital'=>'Harrisburg'), 
     53        //array('id'=>47, 'name'=>"Puerto Rico", 'label'=>"Puerto Rico", 'abbreviation'=>"PR", 'capital'=>''), 
     54        array('id'=>48, 'name'=>"Rhode Island", 'label'=>"Rhode Island", 'abbreviation'=>"RI", 'capital'=>'Providence'), 
     55        array('id'=>49, 'name'=>"South Carolina", 'label'=>"South Carolina", 'abbreviation'=>"SC", 'capital'=>'Columbia'), 
     56        array('id'=>50, 'name'=>"South Dakota", 'label'=>"South Dakota", 'abbreviation'=>"SD", 'capital'=>'Pierre'), 
     57        array('id'=>51, 'name'=>"Tennessee", 'label'=>"Tennessee", 'abbreviation'=>"TN", 'capital'=>'Nashville'), 
     58        array('id'=>52, 'name'=>"Texas", 'label'=>"Texas", 'abbreviation'=>"TX", 'capital'=>'Austin'), 
     59        array('id'=>53, 'name'=>"Utah", 'label'=>"Utah", 'abbreviation'=>"UT", 'capital'=>'Salt Lake City'), 
     60        array('id'=>54, 'name'=>"Vermont", 'label'=>"Vermont", 'abbreviation'=>"VT", 'capital'=>'Montpelier'), 
     61        //array('id'=>55, 'name'=> "Virgin Islands, U.S.", 'label'=>"Virgin Islands, U.S.", 'abbreviation'=>"VI", 'capital'=>''), 
     62        array('id'=>56, 'name'=>"Virginia", 'label'=>"Virginia", 'abbreviation'=>"VA", 'capital'=>'Richmond'), 
     63        array('id'=>57, 'name'=>"Washington", 'label'=>"Washington", 'abbreviation'=>"WA", 'capital'=>'Olympia'), 
     64        array('id'=>58, 'name'=>"West Virginia", 'label'=>"West Virginia", 'abbreviation'=>"WV", 'capital'=>'Charleston'), 
     65        array('id'=>59, 'name'=>"Wisconsin", 'label'=>"Wisconsin", 'abbreviation'=>"WI", 'capital'=>'Madison'), 
     66        array('id'=>60, 'name'=>"Wyoming", 'label'=>"Wyoming", 'abbreviation'=>"WY", 'capital'=>'Cheyenne'), 
    6767); 
    6868