-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am using version 8.6.0.1. I have a instant textbox with an onChange listener inside the auxheader of a grid. Sometimes, when I change the value of the textbox I am missing the input. Also the cursor is moved one char back unrequested.
<grid height="600px" width="1002px" model="@load(vm.scheduleList.scheduleObjectList)" emptyMessage="No Schedules found"
mold="paging" pageSize="11">
<auxhead>
<auxheader colspan="1">
<span sclass="z-icon-filter"/>
<textbox instant="true" width="100px" onChange="@command('changeLineFilter', filter=event.value)"/>
</auxheader>
<auxheader colspan="1">
<span sclass="z-icon-filter"/>
<textbox instant="true" width="100px" onChange="@command('changeEndFilter', filter=event.value)"/>
</auxheader>
<auxheader colspan="1">
<span sclass="z-icon-filter"/>
<textbox instant="true" width="150px" onChange="@command('changeZoneFilter', filter=event.value)"/>
</auxheader>
<auxheader colspan="3">
</auxheader>
</auxhead>
<columns>
<column ...
Here the implementation of the model.
@Command
@NotifyChange("scheduleList")
public void changeLineFilter(@BindingParam("filter") String lineFilter) {
logger.error("Start changed LineFilter:"+lineFilter);
scheduleData.setLineFilter(lineFilter);
logger.error("Finished changed LineFilter:"+lineFilter);
}
@Command
@NotifyChange("scheduleList")
public void changeEndFilter(@BindingParam("filter") String endFilter) {
logger.error("Start changed EndFilter:"+endFilter);
scheduleData.setEndFilter(endFilter);
logger.error("Finished changed EndFilter:"+endFilter);
}
@Command
@NotifyChange("scheduleList")
public void changeZoneFilter(@BindingParam("filter") String zoneFilter) {
logger.error("Start changed ZoneFilter:"+zoneFilter);
scheduleData.setZoneFilter(zoneFilter);
logger.error("Finished changed ZoneFilter:"+zoneFilter);
}
In the output of the logger I see that some chars entered into the textboxes are sometimes not accepted. Sometimes the cursor moves one position back and the input is taken on the wrong position.
Does anyone have the same problem? Is there something how I can fix that?
Best regards,
Christoph
This is the default behavior in grid, and listbox, if the model is replaced @NotifyChange("scheduleList")
and more than 10 items change the whole grid, listbox is invalidated and re-rendered, including the headers and potentially included filter text boxes.
https://github.com/zkoss/zk/blob/v8.6.0.1/zul/src/org/zkoss/zul/Grid.java#L768
You can override the default invalidation threshold by setting the library property org.zkoss.zul.invalidateThreshold or custom-attribute.
e.g. in your zul:
<grid ...>
<custom-attributes org.zkoss.zul.invalidateThreshold="1000"/>
..
</grid>
Since replacing the rows one by one might be slower, please also observe the potential performance impact to your application.
Also please consider using a ListModelList and replace the contents in the model instead of replacing the whole model for each change. This is especially beneficial, in case only a few elements are added or removed.
Asked: 2019-06-25 15:33:13 +0800
Seen: 12 times
Last updated: Jun 26 '19
The issue can be reproduces on the online demo under https://www.zkoss.org/zkdemo/grid/data_filter Enter "12" several times in "Top Nutrients" and sometimes the "2" is not accepted.
cgrill ( 2019-06-25 16:19:38 +0800 )edit