ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: gammax500 on September 24, 2015, 08:12:31 pm
-
I have a grid with a cell containing a primary key value that I want to get while in a different cell that's in the same row.
I've tried various methods but not having much luck. Let me know if I need to provide more details.
//// code outline >
A clip from the dataModel:
dataModel: {
dataType: "JSON",
location: "remote",
recIndx: "admin_login_id", //primary key
method: "GET", ...
And a clip of the column model and the function within the column "password". I want to get the value of "admin_login_id" to pass to a component doing record validation:
colModel: [
{ title: "ID", width: 50, dataType: "integer", editable: false , hidden: false , dataIndex: "admin_login_id" },
{ title: "First Name", width: 100, dataType: "string", dataIndex: "fname", ....
....
....
....
{ title: "Password", width: 150, dataType: "string", dataIndex : "password",
validations: [
{ type: function (ui) {
var value = ui.value;
var validationresp = false;
var validationmsg = "";
====>>> // I want to get the value of the column (admin_login_id) and assign it to idvalue variable
====>>> // Assign a static value for now, until I know how to get the admin_login_id from the grid and assign it
var idvalue = 1;
//remote validation
$.ajax({
url: "/logins.cfc?method=validatepwd",
data: { 'password': value, uid: idvalue },
-
Every callback has ui.rowData property.
You can get the value from ui.rowData.admin_login_id inside the validation callback.
-
There may be an error elsewhere, but I have this code in the callback code.
validations: [
{ type: function (ui) {
var value = ui.value;
var idvalue = ui.rowData.admin_login_id;
alert(value); -- this is defined and gives the correct value for the selected cell
alert(idvalue); -- this is UNdefined
var validationresp = false;
var validationmsg = "";
The column model for the ID is. Do I have that defined correctly?
colModel: [
{ title: "ID", width: 50, dataType: "integer", editable: false , hidden: false , dataIndex: "admin_login_id" },
-
Please correct dataIndex to dataIndx in all columns.
There is no 'e' in all *Indx in PQ e.g., rowIndx, rowIndxPage, dataIndx, colIndx
-
When i replace dataIndex with dataIndx, all of the values disappear from my grid. The grid displays the correct number of records, but the values do not appear. If I change back to dataIndex, then all the data cells are populated.
My JSON looks like, which corresponds to the order of columns in the colModel:
{"COLUMNS":["ADMIN_LOGIN_ID","FNAME","LNAME","EMAIL","PHONE","PHONE_EXT","PASSWORD","DATE_PASSWORD_CHANGED"
],"DATA":[[474,"Tami","Alleman","tamialleman@windermere.com","541-988-0227","482","David33","May, 08
2014 20:59:01"],[453,"Patricia","Atkins","atkinspatricia@eugenerealty.com","541-465-8135","135","Atkinspatricia1"
,"April, 01 2011 00:00:00"],[372,"Barb","Barnard","barb@windermere.com","541-465-8175","175","Realtress421"
,"March, 04 2014 15:51:56"],[386,"David","Baslaw","davidbaslaw@windermere.com","541-465-8116","116","2014Noah"
,"July, 14 2014 18:02:06"]......
-
I have 2 outstanding issues. It turns out the real problem with BOTH was the type of JSON format that Coldfusion was returning to the grid. Once I figured that out, I was able to access the other column data with no problem. That solves this issue. The other issue had to do with the "red icon" indicator for changed data. Once this was solved, that one was solved too.
-
That sounds good.