PDA

View Full Version : Problem adding row editor plugin via designer



sajan
22 Jul 2010, 8:03 PM
Dear All,
I am stuck adding Row editor Grid plugin in my project. What I did was
1. added plugin to my Grid (plugins: [editor] via designer)
2. I added following code to the ui file that contained the grid

var editor = new Ext.ux.grid.RowEditor({
saveText: 'Continue'
});
But as suggested I should not add anything on the ui file. So where shall I place the above code?

3. When the window is clicked for the for the first time everything works fine. Clicking and all
4.But when the window is closed and re opened it shows error like this in the firebug .

f is undefined
f.setValue(val);
RowEditor.js (line 169)

SO not sure what is happening. I think I am doing everything wrong so please guide me.

jarrednicholls
23 Jul 2010, 5:17 AM
Hi sajan,

Instead of the ".ui.js" file, I would promote your Grid to a class of its own (Right-click->Promote to Class) and then add the plugin to the exported ".js" file of the Grid. Promoting your component to a class will mean that it gets its own exported Javascript class file of its own, which is good to do from a component-oriented development standpoint.

Regarding the error you receive, it is because the RowEditor is only being instantiated one time and attempting to be "re-used" on every new instance of your Grid. Instead, you need to create a fresh RowEditor instance with each new Grid instance, because it cannot be re-used. For example:



MyEditorGridPanel = Ext.extend(MyEditorGridPanelUi, {
initComponent: function(){
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Continue'
});
this.plugins = [editor];

MyEditorGridPanel.superclass.initComponent.call(this);
}
});


Hope that helps!

sajan
23 Jul 2010, 7:50 AM
Thanks Jarred,
Since my grid is on a window I think it is not possible to convert that to class. or shall I only change the grid to a class?

jarrednicholls
23 Jul 2010, 9:31 AM
You right click on the Grid and click "Promote to Class". Anything can be promoted to a class...anything! :-)

sajan
23 Jul 2010, 9:38 AM
I tried in window that contains the grid .
and promote to class is still disabled. rt clicked on window
am I missing something?

jarrednicholls
23 Jul 2010, 10:12 AM
Right click on the GridPanel, not the Window :-)

sajan
23 Jul 2010, 10:15 AM
Yes I did that
but now I got problem.
I do have one button on grid now clicking that button shows error

this.buttonref undefined
:D
again halted!!!

thanks