开发者

does jqgrid support a multiple checkbox list for editing

开发者 https://www.devze.com 2023-02-08 17:22 出处:网络
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 w

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??

does jqgrid support a multiple checkbox list for editing


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

does jqgrid support a multiple checkbox list for editing

jQuery("#grid_id").setGridParam({multiselect:true}).showCol('cb');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号