jQWidgets Forums

jQuery UI Widgets Forums Scheduler Setting a value to a jqxComboBox in EditDialogOpen works only the second time

This topic contains 4 replies, has 2 voices, and was last updated by  altivec 8 years, 1 month ago.

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

  • altivec
    Participant

    Hello,

    I am trying to set a value when opening the Dialog box but the first time, nothing’s happen but the second time I open the Dialog, it works …

    Did I missed something ?

    $("#scheduler").on('editDialogOpen', function(event){
                var args = event.args;
                var appointment = args.appointment;
    
                if (appointment != null)
                {
                    console.log("Edition Rendez-Vous -> "+appointment.customer_id);
                    $("#customer1").jqxComboBox('selectItem', appointment.customer_id);
                }
                else
                {
                    console.log("Nouveau Rendez-Vous");
                    $("#customer1").jqxComboBox( 'clearSelection' );
                }
            });

    Thanks for your help.

    Regards,

    Aurélien.


    Peter Stoev
    Keymaster

    Hi Aurélien,

    jqxScheduler does not have ComboBox in the Edit Dialog. It has DropDownList. Even with custom widgets in the edit dialog, you have to use a combination of events EditDialogOpen and EditDialogCreate.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    altivec
    Participant

    Hi Peter,

    Thanks for your reply.

    That’s what I am doing, and it works, but I have to open the dialog, then close it and when I reopen it, the combobox is filled with the correct name.

    Here is my code in editDialogCreate

    
                    customerContainer = "<div>";
                    customerContainer += "<div class='jqx-scheduler-edit-dialog-label'>Cliente</div>";
                    customerContainer += "<div class='jqx-scheduler-edit-dialog-field'><div id='customer1'></div></div>";
                    customerContainer += "</div>";
                    fields.resourceContainer.append(customerContainer);'
    
    

    $j(“#customer1”).jqxComboBox({
    placeHolder: ‘Choisissez une cliente…’,
    width: ‘100%’,
    height: 25,
    source: dataAdapter_customer,
    selectedIndex: -1,
    minLength:3,
    displayMember: “customer_name”,
    valueMember: “customer_id”,
    searchMode:’containsignorecase’,
    autoComplete:true,
    search: function (searchString) {
    dataAdapter_customer.dataBind();
    },
    });`


    altivec
    Participant

    Hi again,

    I tried in JSEDITOR and it works, so I think that comes from the ajax loading.

    Is it possible to test ajax loading with JSEDITOR ?

    Indeed, I noticed that on first opening, the value is setted and then the ajax is calling the list of custome and then whos the “Choose customer…” placeholder of the JQwComboBox.

    Here is my example on JSEDITOR


    altivec
    Participant

    Hi,

    I finally managed to get this working by using async:false to be sure the list is ready before loading the dialog box, but the fisrt time, it is slowing the opening of the modal box.

    Any other solution ?

    var source_customer = {
                datatype: "json",
                dataFields: [
                    { name: 'customer_name' },
                    { name: 'customer_id' }
                ],
                id: 'customer_id',
                type: "GET",
                async:false,
                url: '<?URL;?>agenda/getcustomer'
            };
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.