After populating flexigrid using a JavaScript method from another .js file, I noticed that the CSS is lost once new rows are inserted. Surprisingly, other sections on the page are not affected.
The code snippet I am using is as follows:
var newTbl = '<tr><td>' + id + '</td><td>' + name + '</td><td></tr>';
$('#flexSwitch > tbody:last').append(newTbl);
Here is the HTML structure I used:
<div id="switchGridDiv" style="width: 100%">
<table id="flexSwitch" class="flexigrid">
<tbody>
</tbody>
</table>
</div>
I am aware of the option to use the .css() method in jQuery to address this issue, but considering the size of the flexigrid CSS, it might be inefficient.
Any insights on why this problem occurred or alternative solutions to resolve it would be greatly appreciated.
Thank you in advance!