How to append 2 jsons to the same datatable, like:
$('#divInWhichTableIsRendered').puidatatable({
columns: [
{field:'f1', headerText: 'f1', sortable:true},
{field:'f2', headerText: 'f2', sortable:true},
{field:'f3', headerText: 'f3', sortable:true},
{field:'f4', headerText: 'f4', sortable:true},
{field:'f5', headerText: 'f5', sortable:true}
],
datasource: ourJson1,
});
$('#divInWhichTableIsRendered').puidatatable({
columns: [
{field:'f1', headerText: 'f1', sortable:true},
{field:'f2', headerText: 'f2', sortable:true},
{field:'f3', headerText: 'f3', sortable:true},
{field:'f4', headerText: 'f4', sortable:true},
{field:'f5', headerText: 'f5', sortable:true}
],
datasource: ourJson2,
});
Currently if we do so, the table is populated with ourJson2 & the ourJson1 is over written - which is what we DON'T want.
In fact, I have to highlight some specific rows, based on a certain condition (depends on the Json data), but i am unable to do so. If I apply class to the column..then it gets applied to every row.
First question: As there is no 'addOption' for
puidatatableyou'll need to merge the two datasources (ourJson1andourJson2) before you initiate thepuidatatable.What you are doing right now is to initiate the
puidatatabletwice - once with theourJson1and after that withourJson2. The secondpuidatatableoverrides (obviously) the first one.Second question (you should always ask just one question, if you need to ask another one, create a new question):
Provide the code you execute and we'll be able to help you. We don't know what you have tried and where you have failed.