Forum

jqgrid - fast check...
 
Notifications
Clear all

jqgrid - fast checkbox inline save data

1 Posty
1 Users
0 Reactions
1,333 Widok
0
Topic starter

even before inline mode

1 Answer
0
Topic starter

1. create checkbox col with edittype:’checkbox’
2. set formatoptions: {disabled: false}
3. prepare event

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
            beforeSelectRow: function (rowid, e)
            {
                var $self = $(this);
                iCol = $.jgrid.getCellIndex($(e.target).closest("td")[0]);
                cm = $self.jqGrid("getGridParam", "colModel");
                var localData = $self.jqGrid("getRowData", rowid);
                if (cm[iCol].name === "MY_NAME_OF_CHECKBOX" && e.target.tagName.toUpperCase() === "INPUT")
                {
                    localData.MY_NAME_OF_CHECKBOX = $(e.target).is(":checked");
                    $.ajax({
                        type: "POST",
                        url: "SERVER/savedata",
                        data: $self.jqGrid("getRowData", rowid)
                    });
                }
                return true;
            }
            beforeSelectRow: function (rowid, e)
            {
                var $self = $(this);
                iCol = $.jgrid.getCellIndex($(e.target).closest("td")[0]);
                cm = $self.jqGrid("getGridParam", "colModel");
                var localData = $self.jqGrid("getRowData", rowid);
                if (cm[iCol].name === "MY_NAME_OF_CHECKBOX" && e.target.tagName.toUpperCase() === "INPUT")
                {
                    localData.MY_NAME_OF_CHECKBOX = $(e.target).is(":checked");
                    $.ajax({
                        type: "POST",
                        url: "SERVER/savedata",
                        data: $self.jqGrid("getRowData", rowid)
                    });
                }
                return true;
            }

4. url: ”SERVER/savedata”, is same value of field editurl

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: