jQuery UI Widgets Forums Lists ListBox Problem while checking if value is changed by user or programm

This topic contains 2 replies, has 2 voices, and was last updated by  David_D 7 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • David_D

    I stumbled upon a little problem here and i hope you can give me a hint to solve it.

    I have 2 Listboxes. The first is a List of Tasks and the second one a list of Status’ belonging to the Tasks. When I change the Task the Status of the Task is shown to the User.

    var userselect =true;
    $("#Listview_Task").on('select', function (event) {
            userselect = false;
    		var value_TaskId = $("#Listview_Task").val();
    		//get task Status from DB
                url: "@Url.Action("get_Task_filtered")",
                type: "POST",
                data: { TaskId: JSON.stringify(value_TaskId)},
                datatype: 'json',
                success: function (result) {
                    var source = result;
                    var DB_Task = source[0]
                    $("#Listview_Status").jqxListBox('selectItem', DB_Task.Status); //doesn't trigger listbox changed event for status listbox
            userselect = true;
            //listbox for status listbox changed event triggered here

    The User can change the Listboxstatus and wirte it to the Database to finish a task. I want to differentiate if the status is changed by code or user and therefore I use the userselect boolean.

    $("#Listview_Status").on('change', function (event) {
            var val = $("#Listview_Status").jqxListBox('val');
            if ((val == 3 || val == 4) && (userselect))
                if (confirm('finish Task?')) {
                    if ($("#Listview_Task").val() == "") {
                        alert("No Task to finish selected!");
                    else {
                       //Write new Task Status to DB

    But userselect is always true and I dont know why. Why is the Listview_Status event triggered when the listview_Task select event is finished and not earlier when I change the selected Item of Listview_Status within the Listview_Task select event?


    Hello David_D,

    Everything looks ok.
    If there is not make settings about asynchronous query. (by default)
    This row userselect = true; will be executed before triggered 'change' event of $("#Listview_Status").
    Would you try to move userselect = true; in success of the ajax

    Best Regards,
    Hristo Hristov

    jQWidgets team

    • This reply was modified 7 years, 2 months ago by  Hristo.


    Hello Hristo,
    sorry for the late response and thanks for your help. The problem was indeed the asynchronous setting. By setting async:false in the ajax request the changed-event was triggered when desired.

    Thank you very much.

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

You must be logged in to reply to this topic.