It has been a never ending story of user questions, confusions and frustrations about combo as editor in grid especially if the combo store is loaded from the server. Users went through various configurations of grid renderers pulling the display value from the combo store but failing if the combo store has not yet been loaded or if it pulled data from a large table so it couldn’t be loaded completely. Not speaking about possible performance issues.
This example uses a couple of clever tricks that resolve the combo-editor puzzle once for ever. It is incredibly simple, effective and straightforward. No complex renderers or clumsy methods of displaying the name of the foreign key.
The key is to join tables at the server and to deliver the name of the foreign key together with the grid records data. Some other tweaks are necessary at client too, of course.
- uses cellediting plugin
- combo store pulls cities from the server
- combo is not initially auto-loaded
- typing in combo initiates server search for cities with matching name
- combo uses paging toolbar
- no column renderer for City column
- updated foreign keys (city ids) are persisted to the server database
Well, many… Use it whenever your foreign table is too large so you cannot load the combo editor store at once. Use it when you need to provide search functionality. A simplified version can also be used when you do not need to edit the foreign key itself but the table of values for the combo is too large.
Example Files (relative to example root)
The example has been initially generated with
sencha generate app so the following list contains only added or edited files:
Source CodeIf you want to see the example code, login or sign-up. Free membership is available.