Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Seetharaman Srinivasan on Aug 06, 2008 01:39
open dhtmlx forum
Clearing the combo filter

To clear the combol filter, you have given the following solution on your knowledgebase

for(var i=0; i<this.optionsArr.length; i++){
var z=filter.test(this.optionsArr[i].text)||(this.optionsArr[i].text=="");

Where do I put this code and how do I use it.
Answer posted by Support on Aug 06, 2008 03:18

Can you please point to the original topic, I'm not pretty sure to which use-case mentioned code was related. 

Most probably it mentioned code of dhtmlxcombo.js , lines 962-963
  for(var i=0; i<this.optionsArr.length; i++){
  var z=filter.test(this.optionsArr[i].text);
which can be replaced with mentioned lines

Answer posted by Srinivasan Seetharaman on Aug 06, 2008 03:30
I have #combo_filter added to my grid. User selects one of the entry from this filter. The grid gets refreshed based on the user selection. Now the user wants to clear the selection and gets back to original list. Now the user sees only the entry he has selected in the filter combo. It will be better if he sees a blank row also so that he can get the original list and grid back
Answer posted by Support on Aug 06, 2008 03:41
The combo in filtering mode shows only options which equal to the entered text, so it not possible to show an empty line.
If you have not so many options, usage of #select_filter may be more useful.

The code modification described above, will change logic of combo, so it will always show option with empty text in filtering mode. 
Answer posted by Seetharaman Srinivasan on Aug 06, 2008 04:05
Before I could see your response, I updated dhtmlxcombo.js with the following
var z=filter.test(this.optionsArr[i].text)||(this.optionsArr[i].text=="");

and started testing my combo_filter in my grid. Now I see a change. When I select an entry from the combo filter, grid gets refreshed. The combo text shows the selected value. Now I clicked on the twistie to see anything in the dropdown, the combo text is set to empty and the dropdown has only one entry I selected. Since the combo text is empty, I hit enter to refresh the grid. This never used to happen without this fix. Am I right to assume this solution?
Answer posted by Support on Aug 06, 2008 09:41
>> Am I right to assume this solution?
It possible to add visible empty option to improve usability.  Please check sample ( sent by email ) - it contains combo and filter extension updated in necessary way.