Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › Card View › How to refresh cards without creating new adapters ?
Tagged: card view
- This topic has 3 replies, 2 voices, and was last updated 2 years ago by
Markov.
-
AuthorPosts
-
March 5, 2024 at 1:53 pm #109922
fabriceb
Participanthello,
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/GRLJGXWI 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
March 6, 2024 at 3:29 pm #109931Markov
KeymasterHi,
You need to set the dataSource property to a new value. Using dataAdapter is not mandatory. You can bind it to an array.
Regards,
MarkovMarch 6, 2024 at 8:38 pm #109932fabriceb
Participantif 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.
March 7, 2024 at 3:59 pm #109933Markov
KeymasterHi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.