PDA

View Full Version : Editable combobox in treepanel shows [Object object] in edit mode.



Romick
15 Jun 2012, 1:03 AM
Hello guys!

I have a question. In my case I use Ext.tree.Panel with Ext.grid.plugin.CellEditing.
But when I set combobox as editor field on render I see all as I need but when I try to edit data and click on combobox, somehow it show [Object object] . I have tried different ways to solve this issue but no luck...
Here is my testcase on Fiddle http://jsfiddle.net/7NC7N/8.
Please advise me some solution of this problems.

Thanks

Romick
18 Jun 2012, 12:06 AM
No option? No chance to solve this problem?

scottmartin
18 Jun 2012, 1:34 PM
If you take a look at your renderer, you will see you are returning an object:



renderer: function(val, metadata, record, rowIndex, colIndex, eOpt, treeView){
//return val && val.fullName ? val.fullName : '';
console.log(val);
return val;
}


This is due to your nested json:



text: "homework", expanded: true, user : {id: 1, fullName: 'Romick1'},


Scott.

Romick
19 Jun 2012, 2:06 AM
I didn't get you. Can you explain more clarify?

Actually my renderer does the job. It shows only fullName from the object.
renderer: function(val, metadata, record, rowIndex, colIndex, eOpt, treeView){
return val && val.fullName ? val.fullName : '';
}
but it stored all object itself. Everything looks fine. I can see fullName on my treepanel cell and it's ok. But when I try to edit cell it shows "[object Object]", but it should display fullName value. And that is the problem. Why celleditor didn't take object to show combobox and show it correctly in treepanel cell? I am confused and can't figure out what is happening with editor...

Romick
26 Jun 2012, 4:18 AM
I can't fully migrate my project from 4.0.7 to 4.1.
Here is my testcase on Fiddle http://jsfiddle.net/7NC7N/13/. It works fine on 4.0.7.
Here is my testcase on Fiddle http://jsfiddle.net/7NC7N/8. This one is not working in 4.1.0. (In this case i had remove my custom Ext.grid.plugin.CellEditing overides, because editing works fine in 4.1.0).
I can't get the problem. Does anyone can?

khmurach
26 Jun 2012, 5:44 AM
Problem is in combobox:
In ExtJS 4.0.7 we can set combobox value by valueField, displayField or an object.
In ExtJS 4.1.0 - only by valueField or displayField.

Demos:
http://ext4all.com/post/extjs-4-0-7-combobox-setvalue-method
http://ext4all.com/post/extjs-4-1-0-combobox-setvalue-method

Romick
27 Jun 2012, 12:41 AM
Thank you Vitaliy for so good explanation and demonstration. Now all become more clarifying.
I solve the problem overiding the setValue method.
You are my life saver. Thank you.