jQuery UI Widgets › Forums › Grid › Getting a value in JSON and not displaying in Grid
Tagged: ag grid, angularjs grid, grid.js, jquery grid, jqwidgets, jqwidgets grid, jqxgrid, js grid
This topic contains 3 replies, has 2 voices, and was last updated by realtek 9 years, 3 months ago.
-
Author
-
Hi,
When I am getting columns and data dynamically to populate a grid like below, how can I get a value from my source without displaying it in the grid – so I can then get it later by accessing it through the dataAdapter.records ?
var sourceVirtualFieldGrid = { dataType: 'json', contentType: 'application/json; charset=UTF-8', url: "api/Grid", processData: false, type: "POST", filterable: true, showfilterrow: true, id: "SEQUENCE", root: 'rowsinfo', cache: false, columns: [], datafields: [], beforeprocessing: function (data) { var columnsdata = new Array(); var datafieldsdata = new Array(); for (k in data.columnsinfo) { var col = {}; col.text = data.columnsinfo[k]["DISPLAY_NAME"]; col.datafield = data.columnsinfo[k]["COLUMN_NAME"]; var datafields = {}; datafields.name = data.columnsinfo[k]["COLUMN_NAME"]; columnsdata.push(col); datafieldsdata.push(datafields); sourceVirtualFieldGrid.columns = columnsdata; sourceVirtualFieldGrid.datafields = datafieldsdata; } } };
I suppose I could include it like normal and then hide it on the Grid but I would rather not if possible.
Hi realtek,
You can have a datafield defined in the dataAdapter but it’s not necessary to add such column in the Grid so you can access it through jqxDataAdapter’s records array or you can have a hidden column in jqxGrid and access it through jqxGrid’s getrows method as well. You can choose which option is better for you and your app.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
This is how I am setting up the columns for the Grid, based on a dataAdapter.
I am not sure using the above as the source, how I can not include a specific column on the grid.
If I use the source above then it displays all columns returned in the grid?
$('#Grid').jqxGrid({ columns: sourceVirtualFieldGrid.columns });
For example, I always have a column called ‘Sequence’ which I do not want to include on the Grid.
I would rather not just ‘hide’ the column if possible, although I may have to if there is no other way around it but it sounds like there is by your reply.
Thanks
Hi Peter,
Do you know how this can be achieved please?
Thanks
-
AuthorPosts
You must be logged in to reply to this topic.