PDA

View Full Version : master-detail with loadRecord - altering detail display



jessedp
16 Sep 2010, 12:29 PM
Hi all

I have a grid where a list of users is displayed (masterview).
When an item is clicked, a loadRecord is fired, which populates a formPanel consisting of displayFields (detailview).

In my grid I can use 'renderer' to change the display of a field.

How can I alter the fielddisplay in my formPanel?

troseberry
16 Sep 2010, 12:41 PM
First of all what is some example data of what your trying to specify a custom renderer to. Might be easier to know that first. Because depending on the data you may be able to use the numberfield, datefield, timefield, etc.... Remember the grid uses the renderer to display the data in a cell where as the form you typically would be editing the values where you could implement input masks and vaildations to help keep the formatting of the data within the proper criteria

jessedp
16 Sep 2010, 11:39 PM
Hi

The following image describes the problem:
22449

laurentParis
17 Sep 2010, 12:06 AM
into details area, have you a form with reader ?
If you have a reader on your form, use convert method to do the job

jessedp
17 Sep 2010, 12:57 AM
Hi laurentParis

I don't want to alter my datastore.

This is what I do when a record is selected in the grid.


grid.getSelectionModel().on('rowselect', function(sm, rowIndex, record) {
//load record in sidepanel.
//I want to alter the display of the fields before applying it to the panel
details_formpanel.getForm().loadRecord(record);
});

laurentParis
17 Sep 2010, 3:36 AM
* don't change/modify record argument !!!
* if you don't want alter your datastore (it's mysterious for me ! :) ), on rowselect, create new blank record and apply your datas on new record


var new_rec = new (Ext.getCmp('your_grid_id').getStore().recordType)({
field1: 'field1',
field2: 'field2',
...
});
Ext.apply(new_rec.data, record.data);
new_rec.data.superuser = yourRendererMethod(new_rec.data.superuser, record);
details_formpanel.getForm().loadRecord(new_rec);

jessedp
17 Sep 2010, 3:37 AM
Great!!!

Thx laurentParis!