Hello Isomorphic
I have a code which builds a grid. I want the 'status' column to get changed while I select the checkbox in the 'Select' column. But, while clicking the select checkbox, I get the following error. I will really appreciate if you can help identify the problem.
Error:
09:12:20.999:pointerup8:WARN:Log:TypeError: Unable to get property 'grid' of undefined or null reference
Stack from error.stack:
changed () @ project:97:1060
Class.fireCallback ()
Class.fireCallback ()
ListGrid.rowClick ()
Function code () @ Function code:2:89
GridRenderer._rowClick ()
Class.invokeSuper ()
Class.Super ()
GridBody._rowClick ()
GridRenderer.click ()
Code:
documentGrid: isc.ListGrid.create({
canEdit: true,
editEvent: "click",
editByCell: true,
modalEditing: true,
selectionType: "single",
alternateRecordStyles: true,
canGroupBy: false,
fields: [
{name: "description", type: "text", required: true,
validators: [
{type: "lengthRange", min: 1, max: 30}
]
},
{name: "selected", type: "boolean", width: 80,
changed: function(form, item, value) {
var record = item.grid.getRecord(item.rowNum);
if (value) {
if (record.origStatus && record.origStatus != lead.RegulatoryItemWindow.Status.CANCELED) {
record.status = record.origStatus;
record.ready = record.origReady;
record.sent= record.origSent;
}
else
record.status = lead.RegulatoryItemWindow.Status.REQUESTED;
}
else {
record.ready = null;
record.sent = null;
if (record.origStatus)
record.status = lead.RegulatoryItemWindow.Status.CANCELED;
else
record.status = record.origStatus;
}
item.grid.markForRedraw();
}
},
{name: "status", type: "text", width: 100,
editorType: "select",
editorProperties: {
defaultValue: "Y",
allowEmptyValue: false,
addUnknownValues: false
},
changed: function(form, item, value) {
var record = item.grid.getRecord(item.rowNum);
if (value == lead.RegulatoryItemWindow.Status.READY) {
record.ready = new Date();
record.sent = null;
}
else if (value == lead.RegulatoryItemWindow.Status.CLOSED) {
if (record.ready == null)
record.ready = new Date();
record.sent = new Date();
}
else {
record.ready = null;
record.sent = null;
if (value == lead.RegulatoryItemWindow.Status.CANCELED)
record.selected = false;
}
}
},
{name: "assigned", type: "text", width: 120},
{name: "ready", type: "date", width: 90,
validators: [
{type: "dateRange", max: new Date()}
]
},
{name: "sent", type: "date", width: 90,
validators: [
{type: "dateRange", max: new Date()}
]
}
],
canEditCell: function(row, col) {
var record = this.getRecord(row);
switch (col) {
case 0: // document
return record.code == lead.RegulatoryItemWindow.MISC && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
case 1: // selected
if (lead.RegulatoryItemWindow.allowClose)
return record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
else
return record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
case 2: // status
if (lead.RegulatoryItemWindow.allowClose)
return record.selected && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
else
return record.selected && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
case 3: // assigned
return false;
case 4: // ready date
return lead.RegulatoryItemWindow.allowClose && (record.status == lead.RegulatoryItemWindow.Status.READY || (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED));
case 5: // sent date
return (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED);
}
return false;
}
});
I have made the block bold where I am getting the error. The 'item' argument of the 'changed' function is showing null reference. I am not getting why. Please guide me through this.
Thanks
Akash
I have a code which builds a grid. I want the 'status' column to get changed while I select the checkbox in the 'Select' column. But, while clicking the select checkbox, I get the following error. I will really appreciate if you can help identify the problem.
Error:
09:12:20.999:pointerup8:WARN:Log:TypeError: Unable to get property 'grid' of undefined or null reference
Stack from error.stack:
changed () @ project:97:1060
Class.fireCallback ()
Class.fireCallback ()
ListGrid.rowClick ()
Function code () @ Function code:2:89
GridRenderer._rowClick ()
Class.invokeSuper ()
Class.Super ()
GridBody._rowClick ()
GridRenderer.click ()
Code:
documentGrid: isc.ListGrid.create({
canEdit: true,
editEvent: "click",
editByCell: true,
modalEditing: true,
selectionType: "single",
alternateRecordStyles: true,
canGroupBy: false,
fields: [
{name: "description", type: "text", required: true,
validators: [
{type: "lengthRange", min: 1, max: 30}
]
},
{name: "selected", type: "boolean", width: 80,
changed: function(form, item, value) {
var record = item.grid.getRecord(item.rowNum);
if (value) {
if (record.origStatus && record.origStatus != lead.RegulatoryItemWindow.Status.CANCELED) {
record.status = record.origStatus;
record.ready = record.origReady;
record.sent= record.origSent;
}
else
record.status = lead.RegulatoryItemWindow.Status.REQUESTED;
}
else {
record.ready = null;
record.sent = null;
if (record.origStatus)
record.status = lead.RegulatoryItemWindow.Status.CANCELED;
else
record.status = record.origStatus;
}
item.grid.markForRedraw();
}
},
{name: "status", type: "text", width: 100,
editorType: "select",
editorProperties: {
defaultValue: "Y",
allowEmptyValue: false,
addUnknownValues: false
},
changed: function(form, item, value) {
var record = item.grid.getRecord(item.rowNum);
if (value == lead.RegulatoryItemWindow.Status.READY) {
record.ready = new Date();
record.sent = null;
}
else if (value == lead.RegulatoryItemWindow.Status.CLOSED) {
if (record.ready == null)
record.ready = new Date();
record.sent = new Date();
}
else {
record.ready = null;
record.sent = null;
if (value == lead.RegulatoryItemWindow.Status.CANCELED)
record.selected = false;
}
}
},
{name: "assigned", type: "text", width: 120},
{name: "ready", type: "date", width: 90,
validators: [
{type: "dateRange", max: new Date()}
]
},
{name: "sent", type: "date", width: 90,
validators: [
{type: "dateRange", max: new Date()}
]
}
],
canEditCell: function(row, col) {
var record = this.getRecord(row);
switch (col) {
case 0: // document
return record.code == lead.RegulatoryItemWindow.MISC && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
case 1: // selected
if (lead.RegulatoryItemWindow.allowClose)
return record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
else
return record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
case 2: // status
if (lead.RegulatoryItemWindow.allowClose)
return record.selected && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
else
return record.selected && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
case 3: // assigned
return false;
case 4: // ready date
return lead.RegulatoryItemWindow.allowClose && (record.status == lead.RegulatoryItemWindow.Status.READY || (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED));
case 5: // sent date
return (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED);
}
return false;
}
});
I have made the block bold where I am getting the error. The 'item' argument of the 'changed' function is showing null reference. I am not getting why. Please guide me through this.
Thanks
Akash
Comment