PDA

View Full Version : Issue w/ dynamic grid with combobox columns



vtu
30 Apr 2012, 8:21 AM
Hi, I'm using extjs 4.1 final. I'm creating dynamic grids using the reconfigure method. A couple of my columns need to be a combobox so I have an event listener for beforedit, which in this case checks which column it is, if its the correct column, it sets the column editor to a combobox and the combobox is linked to a store. The issue I'm having is the first time the grid is configured, the comboboxes work fine. I can select the cells within the columns that I defined as a combobox and I can select the values. But once I reconfigure the grid, there is an issue w/ the comboboxes. When I click on a column w/ the comboboxes, the dropdown gets rendered out of place and I can't select the values. I get an error stating "Uncaught TypeError: Cannot read property 'offsetHeight' of undefined ext-all-debug.js:16417"

34698
I'm not sure if its a bug or it's an issue w/ the way I'm implementing it. Any help would be great. Thanks in advance.

scottmartin
30 Apr 2012, 10:50 AM
Do you create a new instance of the combo each time you reconfigure?
Does the combo each time? console.log(combo) after reconfig?

Regards,
Scott.

vtu
30 Apr 2012, 11:07 AM
Do you create a new instance of the combo each time you reconfigure?
Does the combo each time? console.log(combo) after reconfig?

Regards,
Scott.
I used the beforeedit event. What it does is it checks to see if its the column I want, if yes than it sets the column editor so if its a column that I want to be a combobox I do.
event.column.setEditor({
xtype: 'combobox',
id: id,
displayField: prop,
valueField: prop,
store: this.getMyStore(),
queryMode: 'local',
triggerAction: 'all',
lastQuery: '',
editable: true
});

I know this isn't efficient since I would be setting the editor every time I click on one of the combobox column cell's. But it works fine for the initial grid when I reconfigure it again this is when I run into an issue. I thought it would be fine since running the reconfigure would create new columns and get rid of the old editor settings.

scottmartin
30 Apr 2012, 11:47 AM
comment out: id: 'id', see if this helps.

Scott.

vtu
30 Apr 2012, 12:19 PM
comment out: id: 'id', see if this helps.

Scott.

Thanks Scott you helped me solve my issue. By getting rid of the id, I realized it was an error caused by me referencing that id and listening for the expand event. I was trying to link up my comboboxes, where the value of one box affects the other. I added my logic else where and am no longer listening for that event for that specific combobox id and it seems to work fine now. Thanks again