Gridsuggest filter , show whole table when no matches found

Good day ,

is there a way to show whole table when there are no matches found in gridsuggest? Right now when you give a value that does not exists in the Table , the Table disappears. ( a small gif here : https://gifyu.com/image/SOCx ).

Got another small question. When i write something in input field and press enter ( value doesn’t exists in Table ) the first row of the table getting selected and the value in input field changes. Is there a way to prevent the value being changed if the value doesn’t exists in the Table ? ( gif again : https://gifyu.com/image/SOC3 )

Snipped : http://webix.com/snippet/10016a4f

Thank you for your time !

Hi Kirill,

By default, all suggests will try to select the first value from the options list if the value in the input field doesn’t match any option. This behaviour is controlled by the getSuggestion method of the Suggest (and all dependent) widgets.

So, you need to change this method by creating a custom gridsuggest:

webix.protoUI({
	name:"mygridsuggest",
	getSuggestion:function(){
		var id, list = this.getList(), order = list.data.order;
		if (list.getSelectedId) id = list.getSelectedId();

          /*just remove these lines from the default code
           as they set the first option as value*/
		// if (order.length && (!id || order.find(id) <0) )
		// 	id = order[0];

		if (id && typeof id == "object") id = id+"";
		return id;
	},
}, webix.ui.gridsuggest);

Now, when you press “Enter” or the input field is blurred, the field will be set empty if input text doesn’t match any list option.

Please, check the updated snippet: http://webix.com/snippet/dacfb698