简体   繁体   中英

How to jqGrid dynamic multiselecet?

I hava jqGrid checkbox column,This dynamic build

                colNames: ['Id', 'True/False'],
            colModel: [
                { name: 'Id', index: 'Id', sorttype: "int", hidden: false },
                {
                    name: "Selected", index: 'Selected', width: 70, align: "center",
                    formatter: "checkbox", formatoptions: { disabled: false },
                    editable: false, editoptions: { value: "True:False", defaultValue: "No" },
                    stype: "select", searchoptions: {
                        sopt: ["eq", "ne"],
                        value: ":Any;true:Yes;false:No"
                    },
                },

this code selected columns is checkbox how to this column is multiple selection with its own feature jqGrid

Multiselect: true

And I cant checkbox value (true or false ) How can I do it? ;

If selected column value is true, get multiselect (jqGrid feature) true If selected column false,get multiselect column false

Thank you in advance for your help. I wish you a good day.

JavaScript is sensitive on the code:

To enable multiselection use the following code:

$("#grid_id").jqGrid({
  ...
  multiselect : true,
  ...
});

To get the selected rows when a multiselect is enabled do:

var selectedRows =  $("#grid_id").jqGrid('getGridParam', 'selarrrow');

The selectedRows variable is array which every element is a selected row id. If notihing is selected the array is empty - ie selectedRows.length = 0;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM