jQuery UI Widgets Forums Vue(New) Change JqxComboBox Component source dynamically

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 7 months, 3 weeks ago.

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

  • thisBeliever
    Participant

    I have a combobox component like this

    
    <template>
        <JqxComboBox ref="core_combobox"  auto-create:="<code>false</code>" :width="<code>100%</code>" :height="25" @bindingComplete="onBindingComplete($event)"
                     :name="this.tableName+'__'+this.columnName" @input="$emit('input', this.value)" :disabled="this.setDisable"
                      @change="onChange($event)" :source="source" :selectedIndex="this.selectedIndex" :displayMember="'label'" :valueMember="'value'" >
        </JqxComboBox>
    </template>
    

    On change of some value in watchers I do the following

    
    watch: {
        getComboBoxNewValues:{
    
            handler: function(newValue, oldValue) {
                if(newValue[this.columnName]){
                    console.log(newValue);
                    this.source = new jqx.dataAdapter(newValue[this.columnName], {
    
                        downloadComplete: function (data, status, xhr) {
                            console.log(data);
                        },
                        loadComplete: function (data) {
                            //this is for edit mode,
                            // if the setValue is availale then it is in edit mode and
                            // take the value and set it in to the combo box
                            console.log('c'+data);
                        },
                        loadError: function (xhr, status, error) {
                            console.log(error);
                        }
                    });
                    console.log('--------------------------->>>>>>>>>>>>>>');
                    console.log(this.$refs.core_combobox.source);
                    console.log('--------------------------->>>>>>>>>>>>>>');
                }
            },
            deep: true
        },
    }
    

    the newValue[this.columnName] has the following

    
    {
        datatype: 'json',
        url: '/some/url/'
    }
    

    But it doesn’t refresh the source, I am missing something?

    • This topic was modified 7 months, 3 weeks ago by  thisBeliever.
    • This topic was modified 7 months, 3 weeks ago by  thisBeliever.
    • This topic was modified 7 months, 3 weeks ago by  thisBeliever.

    Hristo
    Participant

    Hello thisBeliever,

    If you want to add a new source which seems it is a jqxDataAdapter then you just need to create it again as a new or just update the source.
    Could you check your source?
    Is there any error message in the console?
    I would like to mention that the new jqx.dataAdapter(source) construction expects a source” object there not just a string.
    In a case where you change the source, only you could update after that only the DataAdapter with its dataBind method.
    Could you clarify your case, it will be better if you could provide us with one fully example?

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.