samedi 25 avril 2015

How to get value of checked checkbox (in footer of jqgrid) and send to controller?

I have checkbox in footer of jqgrid and want to send value of checkbox to controller when click on button(Send Command). enter image description here

When a row is selected and click button send command, In addition to its value, the Check box is sent (selected or not selected) My code:

 .jqGrid('navButtonAdd', '#pager',
                       {
                       caption: "Send Command ", buttonicon:"ui-  icon-signal-diag", title: "Send Command ",
                            onClickButton: function () {
                                var selRow =    jQuery("#list").jqGrid('getGridParam', 'selarrrow');  //get selected rows
                                var dataToSend = JSON.stringify(selRow);
                                if (selRow == 0) {
                                    // display error message because no row is selected
                                    $.jgrid.viewModal("#" + 'alertmod_' + this.p.id,
                                        { gbox: "#gbox_" +   $.jgrid.jqID(this.p.id), jqm: true });
                                    $("#jqg_alrt").focus();
                                }
                                else {
                                    $.ajax({
                                        url: '@Url.Action("Index", "AddSMS")',
                                        type: 'POST',
                                        contentType: 'application/json; charset=utf-8',
                                        data: dataToSend,
                                        dataType: 'json',
                                        success: function (result) {
                                            alert('success');
                                        }
                                    });
                                }
                            }
                        })
        $("#pager_left table.navtable tbody tr").append( // here 'pager' part or #pager_left is the id of the pager
'<td><div><input type="checkbox" class="myMultiSearch" id="WithSetting" />Setting </div></td>');

I can send data of row but i don't know how to send value of checkbox???




Aucun commentaire:

Enregistrer un commentaire