|
Title: clear combobox Post by: azizkhani on April 26, 2015, 09:07:54 AM i have a combobox that editable:false,required:false
user select one item and then want to clear selected item how do it ????????????? ??? ??? ??? ??? Title: Re: clear combobox Post by: stworthy on April 26, 2015, 06:20:30 PM Please call 'unselect' method to unselect a item.
Code: var value = ... // the item value to be selected $('#cc').combobox('unselect', value); Title: Re: clear combobox Post by: azizkhani on April 27, 2015, 09:11:15 AM Please call 'unselect' method to unselect a item. Code: var value = ... // the item value to be selected $('#cc').combobox('unselect', value); ;D ;D ;D ;D i asked how user(not developer) can do it? for solve this problem i added a button that user click it and then unselect combo ? this is good idea!!!!! Title: Re: clear combobox Post by: stworthy on April 27, 2015, 05:23:30 PM You can add an icon to the right of input box. When clicking the icon, call 'clear' or 'unselect' methods to unselect the values.
Code: $('#cc').combobox({ icons:[{ iconCls:'icon-clear', handler:function(e){ $(e.data.target).combobox('clear'); } }] }) Title: Re: clear combobox Post by: jjosotoro on May 12, 2015, 06:51:34 AM hello
I dont know if this may help, but why dont you use the keyup event to detect the delete key on the combobox and call the 'unselect' event acordingly. Code: $('#cc').combobox({ inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { keyup:function(e){ if(e.keyCode == 46){ var value = $('#cc').combobox('getText'); // the item value to be selected $('#cc').combobox('unselect', value); } } }) }) regards Title: Re: clear combobox Post by: bvn on January 25, 2019, 11:55:49 AM I always get: "TypeError: $.data(...) is undefined" when trying to clear or unselect item in combobox (combotree in my case).
Code: <input id="parent_id" class="easyui-combotree form-control" name="parent_id" data-options="prompt:'<?=__('Select Parent')?>'"> var parent = $('#parent_id').combotree({ url: baseUrl+'admin/pagesrest/pages_combotree', inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { keyup:function(e){ if(e.keyCode == 46 || e.keyCode == 8){ var value = $('#parent_id').combobox('getText'); // the item value to be selected $('#parent_id').combobox('unselect', value); } } }), icons:[{ iconCls: 'icon-clear', handler:function(e){ parent.combobox('clear'); } }] }); Title: Re: clear combobox Post by: bvn on January 25, 2019, 12:03:03 PM Oh, it's my bug... I used combotree, but in code (copy-pasted) using combobox... that's a reason of my problem. Sorry.
|