Author Topic: Add/Edit/Delete with Grid - Issue for cell selected  (Read 372 times)

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Add/Edit/Delete with Grid - Issue for cell selected
« on: February 11, 2023, 07:16:32 pm »
I am trying to remove the cell selected square box with the below code but it is not working. Please refer to the screenshot attached and advise.

Code: [Select]
beforeCellClick: function (evt, ui) {
if (!evt.ctrlKey && this.SelectRow().isSelected(ui)) {
return false;
}
}

My Grid code as below:
Code: [Select]
$(function ()
{
var loData = "fbAllUser=true";
var objUserMaster =
{
flex: { one: true },
height: 'flex',
rowHt: 30,           
wrap: false,
hwrap: false,           
columnBorders: false, 
stripeRows: false,
strNoRows: 'No User found.',
menuIcon: true,
numberCell: { width: 60, show: false },
trackModel: { on: true },
toolbar: {
items: [
{
type: 'button',
icon: 'ui-icon-plus',
cls: 'add_btn',
label: 'Add User',
listener: function () {
addRowfromgrid(this, 2);
}
}
]
},
scrollModel: { autoFit: true },           
validation: { icon: 'ui-icon-info' },           
colModel: [My User Column Model],
postRenderInterval: -1, //synchronous post rendering.
dataModel:
{
method: "GET",
location: "remote",
recIndx: "stUserUID",
beforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader("Content-Type", "application/json");
},

getUrl: MyWeb API URL,
getData: function (response) {
var loClientMasterJS = $.parseJSON(response.d);
data = loClientMasterJS;
return { data: data, curPage: 1, totalRecords: data.length }
},
error: function (jqXHR, textStatus, errorThrown) {
customalerterror('Error!', jqXHR.responseText, '500px');
}
},
pageModel: { type: "remote" },

//make rows editable based upon the class.
editable: function (ui) {
return this.hasClass({ rowIndx: ui.rowIndx, cls: 'pq-row-edit' });
},
create: function (evt, ui) {
this.widget().pqTooltip();
},
beforeCellClick: function (evt, ui) {
if (!evt.ctrlKey && this.SelectRow().isSelected(ui)) {
return false;
}
},
};
var grid = pq.grid("#MyGridDivID", objUserMaster);

//check the changes in grid before navigating to another page or refresh data.
grid.pager().on("beforeChange beforeRefresh", function (evt, ui) {
if (grid.isDirty()) {
var ans = window.confirm("There are unsaved changes. Are you sure?");
if (!ans) {
return false;
}
}
});
});

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Add/Edit/Delete with Grid - Issue for cell selected
« Reply #1 on: February 13, 2023, 01:26:40 pm »
Please use selectionModel.type = 'row' or null

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Re: Add/Edit/Delete with Grid - Issue for cell selected
« Reply #2 on: February 13, 2023, 05:44:30 pm »
Thank you. It is working.