PDA

View Full Version : assertValue' is null or not an object on IE



Susanta_bmc
11 Nov 2011, 9:03 AM
ExtJs 4.

I have a grid which has the combo editors for the cells .if I select from one combo for a cell and then click on another cell I get the error 'assertValue' is null or not an object: in IE.But If i click in the cell and then click outside and then again click on another cell I don't see this error.

It just works fine with Mozilla.


error details:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; MS-RTC LM 8)
Timestamp: Fri, 11 Nov 2011 01:37:09 UTC


Message: 'assertValue' is null or not an object
Line: 2278
Char: 693186
Code: 0
URI: http://172.23.53.145:8080/itm/projec...=30&taskId=106 (http://172.23.53.145:8080/itm/project.do?action=view&id=30&taskId=106)


Any help will be really appreciated.
And yes when i look at the ext-all-debug.js,
I am getting this error at line number: 60727
at:


if (field.assertValue) {
field.assertValue();
}




completeEdit: function (remainVisible) {
var me = this,
field = me.field,
value;

if (!me.editing) {
return;
}


if (field.assertValue) {
field.assertValue();

}

value = me.getValue();
if (!field.isValid()) {
if (me.revertInvalid !== false) {
me.cancelEdit(remainVisible);
}
return;
}

if (String(value) === String(me.startValue) && me.ignoreNoChange) {
me.hideEdit(remainVisible);
return;
}

if (me.fireEvent('beforecomplete', me, value, me.startValue) !== false) {

value = me.getValue();
if (me.updateEl && me.boundEl) {
me.boundEl.update(value);
}
me.hideEdit(remainVisible);
me.fireEvent('complete', me, value, me.startValue);
}
},




When i add alert inside assertVal method or a breakpoint then it goes fine:


assertValue: function () {
var me = this,
value = me.getRawValue(),
rec;

if (me.forceSelection) {
if (me.multiSelect) {


if (value !== me.getDisplayValue()) {
me.setValue(me.lastSelection);
}
} else {


rec = me.findRecordByDisplay(value);
//alert(value);
if (rec) {
me.select(rec);
} else {
me.setValue(me.lastSelection);
}
}
}
me.collapse();
},

skirtle
11 Nov 2011, 9:37 AM
Exact ExtJS version?

Log out field and field.assertValue on the line before the if check.

Beyond that I think we'll need a complete, minimal test case.

Susanta_bmc
11 Nov 2011, 10:40 AM
The ExtJs version is 4.0.6

the field is coming undefined.
I don't see this issue with IE 9 or chrome.
Test case:

I have a grid where two columns has editors as combo. Once you select from one combo and then go ahead and click on the below cell from the same column then we see this issue. Looks like the value is not been set by that time hence it comes undefined.

Let me show you the UI:

The below shown is the combo associated with the grid, i select one of the values

29239


And select as shown and you can see it is still on focus

29240
and then i click on the 2nd row first column and I get the below shown error. When i put an alert in the ext-all-debug.js for the field value, at this point it comes null.


29238



Please let me know if you need any more details.

Susanta_bmc
12 Nov 2011, 2:08 PM
Please find the attched code. I took the cell-editing example and modified to replicate the problem. I am using MVC and it has exactly same structure what i have implemented in my code.


Though i don't see consistently but while playing around, this issue pops up only with IE 8.

29251

Susanta_bmc
15 Nov 2011, 9:09 AM
I got the solution, This was happening because I was trying to set editor from cellclick listener it is most likely too late. Clicks (mousedowns?) are handled internally by Ext so the listener are very well run after the editing is triggered, that's why Ext tries to start editing on the column before the editor is defined.

So as a part of the solution I tried something:





init: function () {
Ext.getStore('CellEditingStore').load();
this.control({
'viewport > panel': {
render: function(comp){
var columns = Ext.getCmp('CellEditingGrid').columns;
columns[1].setEditor({
xtype: 'combobox',
triggerAction: 'all',
selectOnTab: true,
submitEmptyText: false,
queryMode: 'local',
forceSelection: true,
autoSelect: true,
allowBlank: false,
store: [
['Shade', 'Shade'],
['Mostly Shady', 'Mostly Shady'],
['Sun or Shade', 'Sun or Shade'],
['Mostly Sunny', 'Mostly Sunny'],
['Sunny', 'Sunny']
],
lazyRender: true,
listClass: 'x-combo-list-small'
})

}
},



It works fine. The problem with me was I can not set the editors as the columns are dynamically defines and comes through a json , and on the fly I push the columns to the grid.

Anyhow this works for me.

Thanks

juluren
20 Jun 2012, 1:38 AM
try beforeedit (mk:@MSITStore:D:\%E6%A1%8C%E9%9D%A2\Ext3.2%E4%B8%AD%E6%96%87API(%E6%9C%80%E7%BB%88%E5%AE%8C%E6%88%90%E7%89%882010-11-01).CHM::/ext-3.2.0/docs/source/EditorGrid.html#event-Ext.grid.EditorGridPanel-beforeedit)