SmartClient Version: v10.1p_2016-12-11/Enterprise Deployment (built 2016-12-11)
Chrome Version 64.0.3282.167
I'm running into an issue with a ListGrid I'm building. The grid is defined in a ds.xml descriptor, and several of the columns have foreignKey/includeFrom relationships, so their values are automatically fetched from their external ds.xml files. All my fetch, add, update, and remove operations are tied to EJB methods on the server for creation, deletion, etc. All of the foreignKey relationships work and display SelectItems, but I'm wanting some of the fields to be dependent on selections in other fields.
I've tried following both examples of Dependent Selects in the Showcase, but neither really got me what I was looking for because one of them defines the values for it's fields from static maps, and the other uses DynamicForm. I have a dependent relationship setup between 2 columns currently that I've been tinkering with. I have a ChangedHandler assigned to column 1 where the onChanged method takes the key for the selected object in column 1 and assigns it as optionCriteria for column 2. If I click away from the entire ListGridRecord (so that the edited value shows blue edit text), I can click on column 2 and get the desired results from that fields fetch. What I'd LIKE is to not have to click out of the record every time I make a change in one of the columns.
Here is the code from my grid's constructor:
Is there some way I can force fieldTwo to automatically fetch with the new criteria when fieldOne is chanegd without having to click away from the record every time? Please let me know if I need to provide more information or clarify anything.
Chrome Version 64.0.3282.167
I'm running into an issue with a ListGrid I'm building. The grid is defined in a ds.xml descriptor, and several of the columns have foreignKey/includeFrom relationships, so their values are automatically fetched from their external ds.xml files. All my fetch, add, update, and remove operations are tied to EJB methods on the server for creation, deletion, etc. All of the foreignKey relationships work and display SelectItems, but I'm wanting some of the fields to be dependent on selections in other fields.
I've tried following both examples of Dependent Selects in the Showcase, but neither really got me what I was looking for because one of them defines the values for it's fields from static maps, and the other uses DynamicForm. I have a dependent relationship setup between 2 columns currently that I've been tinkering with. I have a ChangedHandler assigned to column 1 where the onChanged method takes the key for the selected object in column 1 and assigns it as optionCriteria for column 2. If I click away from the entire ListGridRecord (so that the edited value shows blue edit text), I can click on column 2 and get the desired results from that fields fetch. What I'd LIKE is to not have to click out of the record every time I make a change in one of the columns.
Here is the code from my grid's constructor:
Code:
this.setWidth100(); this.setHeight("40%"); this.setDrawAheadRatio(4); this.setShowFilterEditor(false); this.setCanSelectCells(false); this.setSelectOnEdit(true); this.addDrawHandler(event -> { final ListGridField fieldOne = this.getField("parentKey"); final ListGridField fieldTwo= this.getField("childKey"); fieldOne.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { Integer parentKey = (Integer) event.getValue(); Criteria criteria = new Criteria(); criteria.addCriteria("parentKey", parentKey); fieldTwo.setOptionCriteria(criteria); } }); });
Comment