JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Card View How to refresh cards without creating new adapters ?

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #109922
    fabriceb
    Participant

    hello,

    I’m used with jqwidgets to use “updateboundata” to refresh for example my grids.

    But there is no method like this to refresh cards.

    The only way I’ve found to refresh my cards is to create new adapters.
    Is it the right way ?

    for example I have a refresh button, my code is :

    $(‘#bt_Refresh’).on(‘click’, function(){

    // —
    // here, some code to create a new array aDataEquipeEPS
    // —

    aSrcAdapter.dataSource = aDataEquipeEPS;
    oAdapterCard = new Smart.DataAdapter(aSrcAdapter);
    oMyCardView.dataSource = oAdapterCard;
    });

    (on jqwidgets, I don’t creat new adapter, I just change my localdata and ask for an updatebounddata.)

    here is an example on codepen :
    https://codepen.io/mogador/pen/GRLJGXW

    I already have created the oAdapterCard  on initialisation, but I don’t know how to modify it without creating a new adapter.

    (sorry for the poor language explanations, my english is quite bad…)

    fabriceb

    #109931
    Markov
    Keymaster

    Hi,

    You need to set the dataSource property to a new value. Using dataAdapter is not mandatory. You can bind it to an array.

    Regards,
    Markov

    #109932
    fabriceb
    Participant

    if you mean that in my example, I could just use :

    newArray = [];

    (// create new array)

    oMyCardView.dataSource = newArray;

     

    ==> it doesn’t work, you lose the description of the datafields, and some fields juste explode………

    see my example :

    https://codepen.io/mogador/pen/GRLJGXW

    if you click on 2nd button, some fields are unusable : text is transformed to data object.

     

    #109933
    Markov
    Keymaster

    Hi,

    The only issue here is that since the dataFields are defined in dataAdapter and when you use Array instead of DataAdapter, the data is repsesented as Strings instead of the actual data types. This can be easility solved by using the “dataSourceSettings” proeperty which you can use to define your dataFields and data types.

    Regards,
    Markov

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.