Hi all,<div>I have a problem: I'm not able to set correctly the sortInfo to have my data ordered in my GridPanel by a column.</div><div>I've spent lot of time by forum but I was not able to find a solution for me.</div>
<div>I load a WFS layer from MapServer/Postgis, then I like order the data (like 20-30 records) by date field.</div><div>My date field originally come from Postgres "timestamp", but here I translate it as string.</div>
<div>Anyway I don't know why Ext order my records with this column "full_date", in ascending order, and I'm not able to reverse this order, or better change the field to use for order my data (like "magnitudo", that is a double field).</div>
<div><br></div><div>I use Ext 3.4.0, and I try my page on Chrome.</div><div><br></div><div>Thanks everyone could give me a suggest!!!</div><div><br></div><div>The code (the commented line are my test:they don't work):</div>
<div><br></div><div><div>var sismi = new OpenLayers.Layer.Vector("Sismicitā strumentale - ultimi 15 giorni", {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>styleMap: styleMap_sismi,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>strategies: [new OpenLayers.Strategy.Fixed()],</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>protocol: new OpenLayers.Protocol.WFS({</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>url: urlMS_sismi, version: "1.1.0", featureType: "sism_last15",</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>featureNS: "<a href="http://mapserver.gis.umn.edu/mapserver">http://mapserver.gis.umn.edu/mapserver</a>",</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>extractAttributes: true, extractStyles: true, geometry: "msGeometry", srsName: "EPSG:32632"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>})</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>});</div><div>var store_sismi = new GeoExt.data.FeatureStore({</div><div> fields: [</div><div> {name: "latitudine", type: "float"},</div>
<div> {name: "longitudine", type: "float"},</div><div> {name: "profondita", type: "float"},</div><div> {name: "magnitudo", type: "float", mapping:"magnitudo"},</div>
<div> {name: "regione_geografica", type: "string"},</div><div> {name: "num_fasi", type: "integer"},</div><div> {name: "max_gap_az", type: "integer"},</div>
<div> {name: "localita", type: "string"},</div><div> {name: "full_date", type: "string"}</div><div> ],</div><div> layer: sismi</div><div> //, remoteSort: false //to enable sorting from server</div>
<div> , sortInfo:{"field": 'magnitudo', "direction": "DESC"} //don't work...</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//, paramOrder:['magnitudo'] </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>});</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//store_sismi.setDefaultSort('magnitudo', 'DESC');</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//store_sismi.sort('magnitudo', "DESC");</div>
</div><div><br></div><div><div>gridPanel = new Ext.grid.GridPanel({</div><div> xtype : 'grid', //a cosa serve?</div><div> title: "Elenco degli eventi sismici",</div><div> region: "south",</div>
<div> //stripeRows: true,</div><div> columnLines: true,</div><div> viewConfig: {forceFit: true},</div><div> store: store_sismi,</div><div> loadMask: true, //a cosa serve?</div>
<div> height: Math.round(height_map*0.4), //280</div><div> autoScroll: true,</div><div> collapsible: true,</div><div> collapsed: false,</div><div> //sm: new GeoExt.grid.FeatureSelectionModel(), //per sincronizzare grid e features</div>
<div> cm: new Ext.grid.ColumnModel({</div><div> defaults: {</div><div> sortable: true</div><div> },</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>columns: [<span class="Apple-tab-span" style="white-space:pre">                                                </span></div>
<div> {header: "<b>Magnitudo [ML]</b>", dataIndex: "magnitudo", decimalPrecision: 2,</div><div> align: "center", width: 150},</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>{header: "<b>Tempo origine</b>", dataIndex: "full_date", width: 175},</div><div> {header: "Prof. [km]", dataIndex: "profondita", decimalPrecision: 2, align: "center"},</div>
<div> {header: "Lat", dataIndex: "latitudine", decimalPrecision: 3, align: "center"},</div><div> {header: "Lon", dataIndex: "longitudine", decimalPrecision: 3, align: "center"},</div>
<div> {header: "Regione geografica", dataIndex: "regione_geografica", width: 180},</div><div> {header: "Localita", dataIndex: "localita", width: 180},</div>
<div> {header: "Nfasi", dataIndex: "num_fasi", align: "center"},</div><div> {header: "gap", dataIndex: "max_gap_az", align: "center"}</div>
<div> ]</div><div> })</div><div> //,autoLoad: true //se true anche se il layer non č sulla mappa viene caricato</div><div> });</div></div>