jeudi 21 avril 2016

uncheck the checkbox upon saving a row

guys i am using a jqgrid and whenever i checked a check box the row is editable but i have 2 issues ... 1- after editing the row the checkbox is still checked but i want it to be unchecked upon entering enter and saving the row .. 2- i want to click on one checkbox at a time here is my code

dataGrid.prototype = {

        display : function() {
                var self = this;
                var html = [];
                var check = 0;
                var lastSelection;
                html.push("<table id='" + this.id + "" + "'class='table'>\n</table>");
                html.push("<div id='pagger_" + this.id + "'></div>");
                $('body').append(html.join(""));
                $("#" + this.id).jqGrid({
                                                        url : "index.jsp",
                                                        styleUI : 'Bootstrap',
                                                        .....
                                                        loadComplete : function() {
                                                                        $("#" + this.id).on("click", "input[type=checkbox]", function(e){
                                                                                  var $this = $(this); //this is the checkbox
                                                                                  var rowid = $this.parents('tr').attr('id');
                                                                                  self.editRow(rowid);            
                                                                                
                                                        });
                                                                }
                                                        

                                                });
        },

        .....
    
        editRow : function(id) {
                var lastSelection;
        if (id && id !== lastSelection) {
                $("#" + this.id).jqGrid('restoreRow',lastSelection);
                $("#" + this.id).jqGrid('editRow',id, {keys:true, focusField: 1});
            lastSelection = id;
        }
    }

};

any help ?? thanks in advance :)




Aucun commentaire:

Enregistrer un commentaire