jQuery UI Widgets › Forums › Grid › Version 2.8
This topic contains 8 replies, has 4 voices, and was last updated by Peter Stoev 9 years, 2 months ago.
-
AuthorVersion 2.8 Posts
-
Hello,
with this new version, it seems that I haven’t the possibility of using 2 times the same datafield in a grid.
Before (version 2.7) my code was :
$("#jxgGridOrder").jqxGrid( { source: dataAdapter, autoheight: true, columns: [ { text: 'Id', datafield: 'Id', width: 100 }, { text: 'Name', datafield: 'Name', width: 150 }, { text: 'Date de Création', datafield: 'CreationDate', width: 250 }, { text: '', datafield: 'Id', width: 20, cellsalign: 'right', cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { return '<div style="text-align:center"><a href=\'javascript:CancelOrder(' + value + ')\'><img src=\"../../Content/images/glyphicons/png/glyphicons_207_remove_2.png\" height=15 width=15/></a></div>'; } } ] });
Now I have an error messge :
Invalid column ‘datafield’ setting. jqxGrid’s columns should be initialized with unique data fields.If I remove the second usage of the Id field, everything is fine.
Is it a normal behavior with the new version ?Thanks
SylvainOups sorry,this post is for the grid section ! I though I was there.
Hello SylvainD,
Yes, with version 2.8, column datafields cannot be the same.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Ok, so … How should I change to make it work ?
Thanks
SylvainI used : dataAdapter.records[row][‘datafilename’]
Is-it the right way to do it ?
Hi SylvainD,
You should use datafields with unique names or copy a datafield into another one, e.g.:
var source = { localdata: data, datatype: "array", datafields: [ { name: 'firstname', type: 'string' }, { name: 'firstnameCopy', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' } ] }; var dataAdapter = new $.jqx.dataAdapter(source, { beforeLoadComplete: function (records) { for (var i = 0; i < records.length; i++) { records[i].firstnameCopy = records[i].firstname; }; return records; } } );
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Ok.
Thanks
This works at client side
But I am using Server side filtering and sorting
how can I get the column name in case of server side sorting and filteringHi raman1987,
The “getcolumn” method returns the column’s object. Ex: http://jsfiddle.net/jqwidgets/HDz7p/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.