In a previous post we described how we have provided a replacement for APEX Popup LOV’s using an Ext combo/search equivalent in our Ext Integration framework. Originally we transformed an existing Popup LOV (excluding value/key pairs) or a text field, thus we were restricted to ensuring display/return values remained the same.
So over the past couple of days I’d been tasked with enhancing the functionality to support Cascading LOV’s and key/value (display/return) pairs in Standard and Tabular Forms (See our old posts for more details). So the first step was to allow the display/return values to be different. When enabling a transform of an APEX “Popup Key LOV” into an Ext equivalent I also needed to ensure that I updated a hidden field on the page which is always “ITEM_NAME”_HIDDEN, failing to do so will result in session state not being updated, since this hidden field holds the actual “return” value.
For tabular forms there was no “Popup Key LOV” item so I had to come up with an alternative solution which was to use a standard select list as it supports a display/return key/value pair. We simply set a class attribute in “Element Attributes” under “Tabular Form Element” e.g. class=”ext-form-popup-lov:2:10″ to identify it for our transform routine which runs on the Ext Grid’s Store “load” event.(I’ll explain the last couple of numbers in the class setting a little bit later)
The great thing about Ext JS is that we can create a combo box based on an existing select list using the “transform” config option, what makes life even easier is that an Ext combo can also be turned into a search/popup lov equivalent using some additional config e.g.
Normal Ext LOV
var combo = new Ext.form.ComboBox({
id: comboid,
allowBlank: lAllowBlank,
typeAhead: true,
triggerAction: 'all',
transform: select,
width: (select.getWidth() <= 0) ? 200 : select.getWidth(),
forceSelection: true
});
Popup Ext LOV
var popupLov = new Ext.form.ComboBox({
id: comboid,
store: ds,
displayField: 'DISPLAY_VALUE',
valueField: 'RETURN_VALUE',
allowBlank: lAllowBlank,
typeAhead: false,
loadingText: 'Searching...',
emptyText:null,
queryParam: 'x03',
width: (el.getWidth()) ? el.getWidth() : 300,
triggerClass:'x-form-search-trigger',
triggerAction:'all',
minChars: parseInt(comboParams[1]),
pageSize: parseInt(comboParams[2]),
tpl: resultTpl,
transform: el.dom.id,
itemSelector: 'div.search-item'
});
What this means is that we can reuse the same function for adding our cascading lov “select” event if it was a parent LOV (i.e. it was referenced by other LOV’s). This event fires an On-Demand process which generates a single JSON object which contains the results for all the dependent/children LOV’s e.g.
if (isParent) {
// Cascading LOV, has dependencies and needs to update their content, so lets add an on select event
Ext.app.casLovFetchEvent(popupLov, popupLovId, null, (pIsTabForm) ? pIsTabForm : false);
}
We then simply load the stores with this returned JSON object, great thing is that the store has been defined exactly the same for a select list and a popup lov so we don’t need to make any code changes.
e.g.
for (var idx in jsonObj) {
Ext.getCmp(idx).getStore().loadData(eval("jsonObj" + "." + idx));
Ext.getCmp(idx).setValue(eval("jsonObj." + idx + ".row[0].RETURN_VALUE"));
}
We the added some additional support around specifying how many characters can be entered before a search is fired and also the page size for the data for pagination. We simply did this by adding some additional config in the actual class setting separated by colons e.g.

Finally all we need to do for items defined as Popup LOV’s is to remove the icon and anchor link around it…
e.g.
Ext.select("a[href*=genList]").each(function (e) {
e.dom.style.display = "none";
});
The end result is declarative cascading LOV support for standard & poup LOV’s in both standard and tabular forms which can be either the parent or child/dependant LOV. Here’s a couple of examples from our dev environment….


