does jqgrid support a multiple checkbox list for editing
I am playing around with jqgrid and I want to edit a row entry. One of the cells is a list so I want some sort of multiselect editor inside a cell. i dont see support fo开发者_如何学JAVAr a cell edit where i can choose multiple entries from a list. select (either multiselect list or even better a dropdown of checkboxes)
is there any support for something like this??
Working example:
{ name: "Id_ListaMultiple", index:"Id_ListaMultiple",editable:true,edittype:"custom",editoptions:{custom_element:multiCheckElem, custom_value:multiCheckVal,list:"2:Reposición;1:Solicitud Inicial"}},
function multiCheckElem(values, optio) {
var id = optio.id;
var ctl = '<div id="'+ id + '" class="checklist">';
var ckboxAry = optio.list.split(';');
var aValues = [];
if (values && values.length)
{
aValues = values.split(",");
}
for (var i = 0; i < ckboxAry.length; i++)
{
var item = ckboxAry[i].split(':');
ctl += '<input type="checkbox" ';
if (aValues.indexOf(item[0]) != -1)
{
ctl += 'checked="checked" ';
}
ctl += 'value="' + item[0] + '"> ' + item[1] + '</input><br/>';
}
return ctl + '</div>';
}
function multiCheckVal(elem, action, val) {
var items = '';
if (action == 'get') // submitted
{
$("input[type=checkbox]:checked", elem).each(function (i, e)
{
if (items) items += ","
items += e.value;
});
}
else // launched
{
}
return items;
}
Regards Henry
see: http://www.secondpersonplural.ca/jqgriddocs/_2eb0fb79d.htm
jQuery("#grid_id").setGridParam({multiselect:true}).showCol('cb');
精彩评论