Hi Zoltán,

welcome to the list and thanks for the kind words. :)

I'm not an expert on the table widget, but I'd expect it to consider the 
column's data type when sorting. Could you please open a report for this 
in our bug tracking system (http://bugzilla.qooxdoo.org/)?


Regards,
Daniel

Kovács Zoltán schrieb:
> Dear Developers,
> 
> First of all, congratulations to the amazing Qooxdoo system. I started 
> to develop an application by using it.
> 
> I would like to sort number-type columns in a table widget. But 
> unfortunately the numbers behave like strings.
> 
> My code is as follows:
> 
> ...
> __table : function() {
> 
> this.tableModel = new qx.ui.table.model.Simple();
> 
> this.tableModel.setColumns([ this.tr <http://this.tr>("ID"), this.tr 
> <http://this.tr>("Kiadvány"), this.tr <http://this.tr>("Szerző"),
> this.tr <http://this.tr>("Megjegyzés"), this.tr 
> <http://this.tr>("ISBN"), this.tr <http://this.tr>("Ár"),
> this.tr <http://this.tr>("Kiadás éve"),
> this.tr <http://this.tr>("Szempontok")],
> ["id","name","author","comment","code","price","release_year","property"]);
> 
> this.table = new qx.ui.table.Table(this.tableModel);
> 
> this.table.getTableColumnModel().setDataCellRenderer(0, new 
> qx.ui.table.cellrenderer.Number());
> this.table.getTableColumnModel().setDataCellRenderer(5, new 
> qx.ui.table.cellrenderer.Number());
> this.table.getTableColumnModel().setDataCellRenderer(6, new 
> qx.ui.table.cellrenderer.Number());
> 
> this.table.set({
> decorator : null,
> statusBarVisible : false
> });
> 
> this.table.setColumnWidth(0,35);
> this.table.setColumnWidth(1,200);
> this.table.setColumnWidth(2,125);
> this.table.setColumnWidth(3,125);
> this.table.setColumnWidth(4,100);
> this.table.setColumnWidth(5,50);
> this.table.setColumnWidth(6,50);
> 
> this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_SELECTION);
> 
> return this.table;
> },
> 
> loadTable : function() {
> var APP = qx.core.Init.getApplication();
> 
> APP.client.callSync('productManagement','getList',[],qx.lang.Function.bind(this.__updateTable,this));
> 
> },
> 
> __updateTable : function(resp) {
> this.tableModel.setData(resp,false);
> }
> 
> ...
> 
> I learned that I must use the following technique to define a column to 
> be shown as numbers:
> 
> this.table.getTableColumnModel().setDataCellRenderer(0, new 
> qx.ui.table.cellrenderer.Number());
> 
> It works, however, sorting as numbers does not seem to be automatic. If 
> it is not compulsory, I don't want to write compare functions here. Or 
> am I missing something here?
> 
> I also checked the demo example 
> at http://demo.qooxdoo.org/1.2.1/demobrowser/#table~Table.html. 
> Unfortunately, the example JS code seems to show a different approach 
> (because I must fill the table using a remote database using an AJAX call).
> 
> Thank you for your kind help in advance.
> 
> Best regards,
> Zoltan Kovacs
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to