jquery - jqGrid - how to pass both the boolean checked state value and the actual unique value to a checkbox in jqGrid? -


i have jsp page multiple instances of jqgrid. 1 column of grid has checkbox representing if row selected or not. need have normal html checkbox in jqgrid - 1 has both checked/unchecked boolean state , actual unique value like:
<input type="checkbox" name="vehicle" value="car" checked="checked" />

in jqgrid facing limitation wherein can pass 1 value checkbox. in colmodel of jqgrid have this:

colmodel:[     {name:'assign', index:'assign', width:200, editable:true, edittype:'checkbox', formatter:"checkbox", formatoptions:{disabled : false}}     ] 

in passing data jqgrid have kind of data:

var mydata = [               {assign:"${assignbool}"}            ]; 

however value being set in colmodel [] "assign" either boolean value determining if checkbox checked or not or actual value want set checkbox determine checkbox checked.

while passing boolean value checkboxes checked correctly in display couldn't values (the unique identifying values).

while passing actual unique values "assign" checkboxes showing incorrect default checked state checkboxes.

i not determine how pass both checked state boolean , actual unique value of checkbox "assign" row in jqgrid.

i want able traverse through whole page using code below , actual unique values of checkboxes:

$("#editbtn").click(function() {     var val = [];     var checkednames = '';     $('input:checkbox:checked').each(function(index) {         val[index] = $(this).val() + ',';         checkednames += val[index];         }     );       alert("checked check box values: " + checkednames); }); 

if pass boolean checked state "assign" above, getting in checkednames variable list of true/false or yes/no values , not actual values.

has else faced similar problem or have solution issue? me seems limitation of jqgrid or maybe not aware of such functionality in jqgrid. in regard appreciated.

one thing jqgrid manage custom behavior pass html want appear colmodel text. instead of using edit properties you've listed above, send html text in json response server.

jqgrid render html , can manage behavior jquery (which looks you're familiar with).

update example, wanted integrate jquery sparklines grid, in controller on server (i'm using asp.net mvc), return:

return json(new {     total = (int)math.ceiling((double)data.count / rows),     page = 1,     records = data.count,     rows = (from item in data             select new              {                  id = "gr" + data.indexof(item),                  cell = new object[]                   {                       item.name,                      "<span class=\"inlinesparkline\" values=\"" + item.sparklinedata + "\"></span>"                  }              }).toarray()         }); 

in jqgrid, column in colmodel text:

... colmodel: [     { name: 'name', index: 'name' },     { name: 'sparkline', index: 'sparkline', classes: 'sparkcell' } ], ... 

now in gridcomplete, can use jquery whatever need using .sparkcell selector:

... gridcomplete: function () {     $('.sparkcell').sparkline(); }, ... 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -