ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: Digital Logix on February 19, 2016, 05:25:50 am
-
I am using paramquery grid with asp.net web service as datasource. I have implemented auto save feature from demo:
http://paramquery.com/pro/demos/editing_instant
and also added a checkbox selection column to get ids of selected rows to implement custom features. I have used the following demo:
http://paramquery.com/pro/demos/checkbox_id
The auto save feature is working fine but on check/uncheck of checkbox for row selection it marks the row as dirty and posts the data to server. I have tried by setting editable to false on checkbox column but the selection did not work.
How can I make the grid to avoid auto save on row selection using checkbox?
Here is definition of checkbox selection column:
var colM = [{ dataIndx: 'state1', maxWidth: 30, minWidth: 30, align: 'center', resizable: false, type: 'checkBoxSelection', cls: 'ui-state-default', sortable: false, editor: false, dataType: 'bool', cb: { all: false, header: true, select: true }},
---
];
and here is the toolbar definition:
toolbar: {
items: [
{ type: '<strong>' + title + '</strong>' },
{
type: 'button',
label: 'Get Row ID of selected rows',
listeners: [{ 'click': function () {
var $grid = $(this).closest('.pq-grid'),
data = $grid.pqGrid('option', 'dataModel.data'),
checked = [];
for (var i = 0, len = data.length; i < len; i++) {
var rowData = data;
if (rowData.state1) {
checked.push(rowData.StudentsID);
}
}
//sort the ids.
checked = checked.sort(function (a, b) { return (a - b); })
alert(checked);
}
}]
},
---
]
}
Please check my grid implementation using the following link:
http://digitallogix.net/pqtest/
Thank you
-
beforeValidate event can be used to prevent tracking of certain fields.
beforeValidate: function(evt, ui){
if(ui.source == 'checkbox' ){
ui.track = false;
ui.history = false;
}
},
-
Thanks for your suggestion, I have used it and it is not posting data to server now on row selection using checkbox.
I am facing another issue now. I have another checkbox column bound to database field and it is not working with auto save now. The column model is:
{"title":"Status","width":100,"dataIndx":"Status","dataType":"bool","type":"checkbox","hidden":false,"render": function (ui) { var a = 1; } ,"filter":{"type":"checkbox","subtype":"triple","condition":"equal","init": function (ui) { var a = 1; } ,"listeners":[{ 'click': function (evt, ui) { onfilter('Status', $(this), ui.value); } }],"prepend":{}},"editor":{"type":"textbox","init":{}},"editModel":{}}
-
Previous code stops tracking for all checkbox columns.
If there are multiple checkbox columns, please use this:
beforeValidate: function(evt, ui){
if(ui.source == 'checkbox' ){
ui.track = ui.history; //ui.history is false for checkbox selection columns.
}
},
-
Thanks it works.