jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox How to delete a value in ComboBox

Tagged: 

This topic contains 10 replies, has 2 voices, and was last updated by  damc 11 years, 11 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • How to delete a value in ComboBox #22000

    damc
    Participant

    Hi,

    I have two problems.

    1. placeHolder propertie does not work on IE8 and IE9.

    2. How to delete value in combo (set to null). If user use BACKSPACE or DELETE key combo keeps old value?

    Thank you for your help.

    How to delete a value in ComboBox #22003

    Peter Stoev
    Keymaster

    Hi,

    1. placeHolder requires a browser which supports HTML5. Otherwise the INPUT tag’s placeholder attribute is not available. See: http://www.w3schools.com/tags/att_input_placeholder.asp
    2. You cannot delete a value from the ComboBox using Keyboard keys. You can just delete the text displayed in its input field.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    How to delete a value in ComboBox #22006

    damc
    Participant

    Hi Peter,

    Item 2.
    What about to use event unselect and there set value to null?

    Thank you for your answer.

    How to delete a value in ComboBox #22019

    damc
    Participant

    Hi Peter,

    On unselect event I set value with jQuery’s val: $(“#jqxComboBox”).val(”). This works.

    If I have turn on autoComplete then does not work. Combo set’s value on first element. Can you help me?

    Thank you!

    How to delete a value in ComboBox #22279

    damc
    Participant

    Hi Peter,

    Can you help me.

    If is it autoComplete on, I have problem with setting value on empty. How to implement, that user can delete value on combo and is autocomplete on?

    Thank you.

    How to delete a value in ComboBox #22282

    Peter Stoev
    Keymaster

    Hi damc,

    What do you mean by clear the value and setting it to empty? Clear the selection, clear the text in the input field, delete an item or something else?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    How to delete a value in ComboBox #22512

    damc
    Participant

    Hi Peter,

    I would like to clear value in combo when user delete text with BACKSPACE or DELETE key.

    My code:
    On unselect event I set value with jQuery’s val: $(“#jqxComboBox”).val(”). If I have autoComplete = false then this code sets combo’s value to empty. If I have autoComplete = true then doesn’t work because combo sets value on first element.

    I debug code and found difference in args object
    $(“#jqxComboBox”).on(‘select’, function (event) {
    var args = event.args;

    1. autocomplete = false -> index = -1:
    args: Object
    index: -1
    item: null
    owner: a.jqx.define.b.(anonymous function)
    type: “none”
    __proto__: Object

    2. autoComplete = true -> index = 0
    args: Object
    index: 0
    item: Object
    owner: b.(anonymous function)
    type: “none”
    __proto__: Object

    Thank you for your help.

    How to delete a value in ComboBox #22514

    Peter Stoev
    Keymaster

    Hi damc,

    From your explanation, I understand that you want to clear the selection, not to delete an item. You can clear the selection by calling:

    $("#jqxComboBox").jqxComboBox('clearSelection'); 

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    How to delete a value in ComboBox #22519

    damc
    Participant

    Hi Peter,

    On unselect event I have already try this command $(“#jqxComboBox”).jqxComboBox(‘clearSelection’) and this $(“#jqxComboBox”).jqxComboBox(‘selectIndex’, -1 ) and all three together:

    $("#jqxComboBox").jqxComboBox('clearSelection') ;
    $("#jqxComboBox").jqxComboBox('selectIndex', -1 );
    $(“#jqxComboBox”).val(”);

    It is steel the same problem like I wrote it.

    Best regards,
    Damc

    How to delete a value in ComboBox #22520

    Peter Stoev
    Keymaster

    Hi,

    I do not think that “unselect” is the appropriate place for clearing a selection. As far as I understand, you want this to happen on key down when a key is pressed in the input field. I suppose that then you bind to the ComboBox Input field’s keydown event, check whether the pressed key is “Backspace” or “Del” and call the “clearSelection” method when necessary.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    How to delete a value in ComboBox #22543

    damc
    Participant

    Hi Peter,

    I have changed my code:

    $("#jqxComboBox").on('keydown', function (event) {
    if (event.keyCode == 8 || event.keyCode == 46) {
    $("#jqxComboBox").jqxComboBox('clearSelection');
    }
    });

    This also doesn’t work. Combo still selects first item.

    Best regards,
    Damc

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.