jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How do I access the ID with nested json ?
Tagged: datagrid
This topic contains 8 replies, has 2 voices, and was last updated by Peter Stoev 11 years ago.
-
Author
-
[{“SystemEmailgroupEmail”:
{
“Email”:”asdasd@gmail.com”,
“Name”:”asd”
},
“SystemEmailgroupMapping”:
{
“id”:”10″,
“UserId”:”6″,
“groupId”:”6″,
“EmailId”:”11″
},
……………………………In my grid how do I access or declare the id to be the id in SystemEmailgroupMapping ?
var source =
{
datatype: “json”,
datafields:
[
{ name: ‘Name’, map:”SystemEmailgroupEmail>Name”, type: ‘string’ },
{ name: ‘Email’,map:”SystemEmailgroupEmail>Email”, type: ‘string’ },
{ name: ‘groupName’,map:”SystemEmailgroupGroup>groupName”, type: ‘string’ },
],
id: ‘?????????????????????????????????????????????’,
url: url
};Hi jccompagnon,
Did you try with SystemEmailgroupMapping>id ?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Yes but did not seems to work. I will try again
hum.
so I have it as
id: ‘SystemEmailgroupMapping>id’,Later in our code we try to get the rowId
$(“#jqxgrid”).on(“cellclick”, function (event) {
var column = event.args.column;
var rowindex = event.args.rowindex;
var columnindex = event.args.columnindex;
//when user wants to edit the record
if (columnindex == 0) {
var rowID = $(‘#jqxgrid’).jqxGrid(‘getrowid’, 0);so rowID should have the ‘SystemEmailgroupMapping>id’ associated with the first grid row (25) but it returns 0 (the first row in the grid)
What am I missing ?
here, I made a full example
http://jsfiddle.net/B5eH5/3/You can see that when you click on column 0 it returns the grid row id instead of the id
how do we return the id?
Note that I displayed id for the test but in reality we do not display the id in the grid
Updated: http://jsfiddle.net/jqwidgets/KVTR7/
so does that mean that getrowid does not work with nested json mapped and that we need to use getrowdata instead?
Is it a bug in getrowid ?
thanks for the fix regardless
Hi jccompagnon,
That simply means that syntax like exp1>exp2 is not available for the “id” field. There is a big difference whether something is not implemented or is a bug.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.