jQuery UI Widgets Forums Plugins Data Adapter dataAdapter – AJAX/changing URL and parameters

This topic contains 2 replies, has 2 voices, and was last updated by  HectorPuk 9 years, 5 months ago.

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

  • HectorPuk
    Participant

    Hi Folks,

    I need a dropdown list to be populated with some kind of filter based on another field.

    What I am doing is

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘GroupPath’, type: ‘string’},
    { name: ‘NROMovil’, type: ‘string’ },
    { name: ‘PromedioVelocidadMaxExcesiva’, type: ‘string’ }
    ],
    url: ‘services/Consolidado.php?NROMovil=340′, //URL THAT NEEDS LATTER CHANGE
    async: false
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    dataAdapter.dataBind();

    Now I need to change the parameter in the URL to services/Consolidado.php?NROMovil=967.

    My approach is to change dataAdapter._source.url and do Bind again. Is that the right way to do it?

    dataAdapter._source.url=’services/Consolidado.php?NROMovil=967’;
    dataAdapter.dataBind();

    If not, please let me know what is the sound practice to do it.

    Thanks in advance.

    Hector.


    Peter Stoev
    Keymaster

    Hi HectorPuk,

    Using internal and not documented properties is wrong. Why you just don’t create a new dataAdapter instance with your updated source object. That’s more correct and clean approach.

    Best Regards,
    Peter Stoev

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


    HectorPuk
    Participant

    Hi Peter,

    Thanks and Understood. I will follow your recomendation.

    I was looking for examples on dropdown tree, with JSON (source URL, PHP or whatever) and filtering but I was not able to find one; or at least understand one.

    So again, I will follow you.

    Hector.

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

You must be logged in to reply to this topic.