Thanks Christain, I've tried your tip but it doesn't work for me.<div>I don't know why but GeoExt persist to put my data in ascendent order by the "date" column, without ANY specification about that...I don't really understand.</div>
<div><br></div><div>Any other ideas???</div><div><br></div><div>Thanks to all<br><br><div class="gmail_quote">2011/11/4 Christian Mayer <span dir="ltr"><<a href="mailto:mayer@terrestris.de">mayer@terrestris.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>
<div bgcolor="#ffffff" text="#000000">
Hi Riccardo,<br>
<br>
here a code snippet I have in use:<br>
<br>
<tt>myStore.setDefaultSort('magnitudo', 'DESC'); // just after
instanciating the store</tt><br>
<br>
Best regards,<br>
Chris<br>
<div>
<div>
<div><br>
</div>
</div>
</div>
<br>
Am 02.11.2011 12:16, schrieb Riccardo Gaeta:
<blockquote type="cite"><div><div></div><div class="h5">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 style="white-space:pre-wrap"> </span>styleMap:
styleMap_sismi,</div>
<div><span style="white-space:pre-wrap"> </span>strategies:
[new OpenLayers.Strategy.Fixed()],</div>
<div><span style="white-space:pre-wrap"> </span>protocol:
new OpenLayers.Protocol.WFS({</div>
<div><span style="white-space:pre-wrap"> </span>url:
urlMS_sismi, version: "1.1.0", featureType: "sism_last15",</div>
<div><span style="white-space:pre-wrap"> </span>featureNS:
"<a href="http://mapserver.gis.umn.edu/mapserver" target="_blank">http://mapserver.gis.umn.edu/mapserver</a>",</div>
<div><span style="white-space:pre-wrap"> </span>extractAttributes:
true, extractStyles: true, geometry: "msGeometry", srsName:
"EPSG:32632"</div>
<div><span style="white-space:pre-wrap"> </span>})</div>
<div><span style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </span>//,
paramOrder:['magnitudo'] </div>
<div><span style="white-space:pre-wrap"> </span>});</div>
<div><span style="white-space:pre-wrap"> </span>//store_sismi.setDefaultSort('magnitudo',
'DESC');</div>
<div><span style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </span>columns:
[<span style="white-space:pre-wrap"> </span></div>
<div> {header: "<b>Magnitudo
[ML]</b>", dataIndex: "magnitudo", decimalPrecision: 2,</div>
<div> align: "center", width: 150},</div>
<div>
<span style="white-space:pre-wrap"> </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>
</div></div><pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@geoext.org" target="_blank">Users@geoext.org</a>
<a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
<a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>