javascript - ExtJS 6: Issue using multiple editors in a single grid column -
notes
extjs version: 6.2.1.167
fiddle: fiddle.sencha.com/#view/editor&fiddle/1tlt
this functionality worked in extjs 2.x , did not have issues.
goal
to have grid (with grouping feature , cell editing plugin) can have multiple different editors (textfield , combos) in single column.
the grid has reversed traditional table system field names , record values displayed vertically. example of table header shown here:
+-------------+-----------------+-----------------+----------------- - field names - record 1 values - record 2 values - editable column +-------------+-----------------+-----------------+----------------- we cannot use traditional system because there hundreds of fields several records compare.
code
here main code allows me use multiple editors:
ext.define('membercellediting', { extend: 'ext.grid.plugin.cellediting', xtype: 'membercellediting', alias: 'plugin.membercellediting', getcachededitor: function(editorid, record, column) { var me = this, editors = me.editors, dropdownname = record.get('dropdown'); // if dropdown field, use dropdown name editor id if (dropdownname && dropdownname != 'n') editorid = dropdownname; // attempt editor var editor = editors.getbykey(editorid); if (!editor) { if (dropdownname && dropdownname != 'n') { // retrieve combo var combo = dropdownmanager.getcombo(editorid); // create editor combo editor = ext.create('ext.grid.celleditor', { editorid: editorid, // each dropdown field have own combo field: combo, floating: true }); } else { // use default editor configured column editor = column.geteditor(record); } if (!editor) { return false; } // allow them specify celleditor in column if (!(editor instanceof ext.grid.celleditor)) { // apply field's editorcfg celleditor config. // see editor#createcolumnfield. column's editor config may // used specify celleditor config if contains field property. editor = new ext.grid.celleditor(ext.apply({ floating: true, editorid: editorid, field: editor }, editor.editorcfg)); } // add editor floating child of grid // prevent field being included in ext.form.basic // collection, if grid happens used inside form editor.field.excludeform = true; // if editor new grid, add grid, , ensure tells life cycle. if (editor.column !== column) { editor.column = column; column.on('removed', me.oncolumnremoved, me); } editors.add(editor); } // inject upward link owning grid though not added child. editor.ownercmp = me.grid.ownergrid; if (column.istreecolumn) { editor.isfortree = column.istreecolumn; editor.addcls(ext.basecssprefix + 'tree-cell-editor'); } // set owning grid. // needs kept date because in lockable assembly, editor // needs swap sides if column moved across. editor.setgrid(me.grid); // keep upward pointer correct each use - editors shared between locking sides editor.editingplugin = me; return editor; } }); issue
while current code let use multiple editors in single column, "randomly" throws errors. randomly because have not been able track down actual cause of errors.
error #1 unable property style of undefined or null reference
error #2 unable property parentnode of undefined or null reference
the cause of both of these errors because el property on editor referencing has been destroyed, meaning there no dom property.
how reproduce
this part of reason why haven't been able solve this. haven't been able find concrete method of replicating issue. unfortunately way can errors random combination of clicking/tabbing cells, entering data, switching other cells, switching groups, etc... current method worked involves doing entering random data , furiously clicking alternate focus between 2 neighboring cells. of time takes less 30 seconds error.
my current theory there event being fired calls function that, whatever reason, destroys editor's el property. i've tried looking @ value @ top of error's call stacks , appears el property destroyed @ point.
bottom line
i'm looking suggestions on how track down actual cause of issue.
update
it turns out there bug revolving around using combos in cell editors @ moment. here person similar issue:
here bug id: extjs-23330
according sencha support, there no workaround available , bug still open.
update #2
this bug exists in 6.0.2 , 6.5.
fortunately, have found way more consistently reproduce bug:
- hover on group 5 seconds. expand group a.
- hover on (field 1, value column) 5 seconds.
- click in (field 1, value column).
- wait 5 seconds, collapse group a.
- wait 3 seconds, hover on group b header.
- wait 10 seconds, hover on group header.
- wait 3 seconds, expand group a.
- hover on (field 1, value column) field 3 seconds.
- hover on (field 1, value 2 column) 3 seconds.
- click in (field 1, value 2 column).
if error not occur (seemed not happen yet in 6.5):
- wait 3 seconds, click in (field 1, value column).
- wait 1 second, click in (field 1, value column) again.
it isn't 100%, more reliable randomly clicking around.


Comments
Post a Comment