javascript - How to get the particular cell value in JQgrid -


i have written jqgrid working fine need fill sub grid based on selected row of main grid. how can selected row cell value pass in url of subgrid.

columns in main grid ---- id,firstname,lastname,gender.

i need selected row of "id" value.

here script

   $(document).ready(function () {               jquery("#emptable").jqgrid({                  datatype: 'json',                 url: "default1.aspx?x=getgriddata",                 mtype: 'post',                 ajaxgridoptions: { contenttype: 'application/json; charset=utf-8' },                 serializegriddata: function (postdata) {                     return json.stringify(postdata);                 },                 jsonreader: { repeatitems: false, root: "rows", page: "page", total: "total", records: "records" },                   colnames: ['pid', 'first name', 'last name', 'gender'],                 colmodel: [                     { name: 'pid', width: 60, align: "center", hidden: true, searchtype: "integer", editable: true },                     { name: 'firstname', width: 180, sortable: true, hidden: false, editable: true, sorttype: 'string', searchoptions: { sopt: ['eq', 'bw']} },                     { name: 'lastname', width: 180, sortable: false, hidden: false, editable: true },                     { name: 'gender', width: 180, sortable: false, hidden: false, editable: true, celledit: true, edittype: "select", formater: 'select', editrules: { required: true, edithidden: true }, editoptions: { value: getallselectoptions()}}],                 loadonce: true,                 pager: jquery('#emppager'),                 rownum: 5,                 rowlist: [5, 10, 20, 50],                 viewrecords: true,                 sortname: 'pid',                 sortorder: "asc",                 height: "100%",                 editurl: 'default1.aspx?x=editrow',                 subgrid: true,                 // subgridurl: 'default1.aspx?x=bindsubgrid',                 subgridrowexpanded: function (subgrid_id, row_id) {                     // var celvalue = jquery('#emptable').jqgrid('getcell', rowid, 'pid');                      var subgrid_table_id, pager_id;                     subgrid_table_id = subgrid_id + "_t";                     pager_id = "p_" + subgrid_table_id;                     $("#" + subgrid_id).html("");                     jquery("#" + subgrid_table_id).jqgrid({                         url: "default1.aspx?x=bindsubgrid&pid=" + row_id + "",                         datatype: "json",                         mtype: 'post',                         ajaxgridoptions: { contenttype: 'application/json; charset=utf-8' },                         serializegriddata: function (postdata) {                             return json.stringify(postdata);                         },                         jsonreader: { repeatitems: false, root: "rows", page: "page", total: "total", records: "records" },                          colnames: ['pid', 'first name', 'last name', 'gender'],                         colmodel: [                     { name: 'pid', width: 60, align: "center", hidden: true, searchtype: "integer", editable: true },                     { name: 'firstname', width: 180, sortable: true, hidden: false, editable: true, sorttype: 'string', searchoptions: { sopt: ['eq', 'bw']} },                     { name: 'lastname', width: 180, sortable: false, hidden: false, editable: true },                     { name: 'gender', width: 180, sortable: false, hidden: false, editable: true, celledit: true, edittype: "select", formater: 'select', editrules: { required: true, edithidden: true }, editoptions: { value: getallselectoptions()}}],                         loadonce: true,                         rownum: 5,                         rowlist: [5, 10, 20, 50],                         pager: pager_id,                         sortname: 'pid',                         sortorder: "asc",                         height: '100%'                     });                     jquery("#" + subgrid_table_id).jqgrid('navgrid', "#" + pager_id, { edit: false, add: false, del: false })                 }              })  

please find cell value.

thanks purna

if 'pid' column contains unique value can used rowid should add key: true in definition of 'pid' column in colmodel. jqgrid assign id attribute of <tr> elements (the rows of grid) value 'pid' column. after row_id parameter of subgridrowexpanded contain value need , don't need make additional getcell call.

additional remark: strictly recommend use idprefix parameter subgrids , grids. in case jqgrid use value of id attribute have specified prefix. if allow solve conflicts (id duplicates in html page). can have same rowids rows of subgrids , rows of main grid. see here more old answers on subject.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -