Question

I have below code I want to NotiFy only Single item of he List not whole List as if we will NotiFy whole List it will reload data again which is consuming lots of memory and looks ugly.Anyone know Better way to increase performance of application?

@Command
public void valueChangedListnerForCombo(
            @BindingParam("Code") Combobox combobox,
            @BindingParam("BeanData") Record record,
            @BindingParam("ColumnName") String columnName) {
    super.valueChangedListnerForCombo(combobox, record, columnName);
    if (!adminNewListModelList.contains(record) && !changedListModel.contains(record)){
        changedListModel.add(record);
        BindUtils.postNotifyChange(null, null, this , "adminListboxViewModel");
    }
}
Was it helpful?

Solution

Edit : You can notifyChange a single object like this :

BindUtils.postNotifyChange(null, null, record, "*");

Result for your cause : nothing.
Why : Because you do add operation. If it is an update of record this shall work.

You add the object to a listModel so the listModel is changed and has to been notified. If you only call the listmodel and not your getter from your viewmodel you normally have performance gain. (try setting a logger on your getter of the object and see what is all called)

BindUtils.postNotifyChange(null, null, changedListModel, "*");

Edit 2 :

You have your combobox in your method.
Try doing the following in stead of the postNotifyChanged

combobox.invalidate();

This shall set the combobox correct to the underlying model, what you just changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top