PDA

View Full Version : Problems with dependent grid



bkraut
23 Feb 2011, 7:43 AM
Hi,

I'm trying to find the best way how to configure the form for following case:

I have a form with a few fields describing Task (title, date, duration, etc...).

On this form I also have a grid where I have TaskActivities. Following suggested approach I used xtype like this:



{
xtype: 'TaskActivityGrid',
params: {
task: {
uuid: this.params.uuid
}
}
}


I have a task parameter for this grid. The problem emerges when I open this form for a new record. The grid should be disabled. When I store a task, the form window should not close, but it should unlock the grid and reset the TaskActivites grid store. If grid is configured with xtype I can not set anything.

Can I still use xtype also if I have to reconfigure the grid store?

The problem is that I have quite complex objects. When a form with several tabs and grids is loaded it is slow if I'm not using xtype.

Best regrads,
Bojan

drian
23 Feb 2011, 10:54 AM
is TaskActivityGrid a grid panel?

if so, after you get a reference to it either by id, itemId or ref you can use .getStore().reload() to reset the data store and a simple .hide() or .disable() on the grid will hide it or disable it.

bkraut
23 Feb 2011, 3:52 PM
Thank you. You pointed me in the right direction. I wasn't aware of ref and itemId. id I can not use as I can have several components and id is unique.

This is how I did it:



var p1 = this.find('ref', 'taskActivityGrid');
p1[0].disable();

drian
23 Feb 2011, 10:02 PM
if the component you're trying to fetch is referenced to an already fetched component, you can use it like this:



ref: '../../yourNameHere'

get yourNameHere component : yourBaseReferenceComponent.yourNameHere

Condor
23 Feb 2011, 11:43 PM
This is how I did it:



var p1 = this.find('ref', 'taskActivityGrid');
p1[0].disable();


No, that is the method you would use for 'itemId'.

The whole point of 'ref' is that you don't have to use find().

If you configure the grid with:

ref: '../../taskActivityGrid'
(I don't know the exact ../.. depth your grid is relative to the container)
And in the container you can then simply use:

this.taskActivityGrid.disable();

bkraut
4 Sep 2011, 1:08 PM
Thanks Kondor,

this is very good. I'll correct the code.