json - jqGrid Access Extra Information -


i have dynamically created jqgrid custom formatter. need able access information not in grid column within formatter. problem rowobject seems contain information columns , nothing else, though json data has attribute.

my json looks like:

{"rows":   [     {"cell":["637","alice","test","01\/01\/1980",""],"id":"637","patient_id":"637"},     ...     {"cell":["635","alice","test","01\/01\/1980",""],"id":"635","patient_id":"635"},   ],   "form_id":"3",   "records":"35",   "total":2,   "goto_patient_sidebar":"1",   "totalrecords":"35",   "dynamicfilters":"",   "listname":"patients",   "page":1,   "recordsreturned":25,   "columns":   [     {"id":"75","field_id":"2","zmr_list_id":"13","alias":"last name",     "sortorder":"0","reference_field_id":"90","show_date":"0","show_time":"0"},      {"id":"76","field_id":"1","zmr_list_id":"13","alias":"first name",     "sortorder":"1","reference_field_id":"90","show_date":"0","show_time":"0"},      {"id":"77","field_id":"25","zmr_list_id":"13","alias":"dob",     "sortorder":"2","reference_field_id":"90","show_date":"1","show_time":"0"},      {"id":"78","field_id":"47","zmr_list_id":"13","alias":"phone number",     "sortorder":"3","reference_field_id":"90","show_date":"0","show_time":"0"}   ]  } 

for each row, need access patient_id json. data columns of each row contained in 'cell' each row. rowobject seems contain information in each cell attribute of json. how can access patient_id without being rendered in column?

in data values of patient_id same id. suppose there can different (if patient_id equal id can see information in custom formatter already). can implement need in @ least 3 ways:

  1. you add hidden column (having property hidden:true) represent patient_id. move information patient_id in json input inside "cell" array.
  2. you place information mapping between id , patient_id part of userdata include in json (see here more information).
  3. you use data parameter of loadcomplete event handle. data parameter contain full json data posted server. can information need data , save somewhere. saved information custom formatter.

one more small remark json data. use items like

{     "cell": [         "637",         "alice",         "test",         "01\/01\/1980",         ""     ],     "id": "637", } 

(if forget patient_id). means send id information twice: 1 part of column , second time first column of grid. if include key:true setting in definition of first grid column , add jsonreader: {cell:""} make json data in more compact row item in array form

[     "637",     "alice",     "test",     "01\/01\/1980",     "" ] 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -