On my angular page i have three accordions. Each loads a component view with a danymic generated table inside. This means, i have table one, two and three on the whole page. Above each table is a JQuery part to access this table. Actually i do this by finding the table via the css class (ex. table.scrolling-table).
This works fine with the first table 'cause the code only can find the first table on page (but i have three different).
Each table has a dynamic id called dataTable_{{$ctrl.entry.id}}
.
Now i want to access this id with the JQuery call.
How can i apply the danymic id in my JQuery table inside the component?
Angular Component View
<table id="dataTable_{{$ctrl.entry.id}}" class="table scrolling-table">
<tr>...</tr>
</table>
<script>
bodyColumnWidth(){
var $table = $('table.scrolling-table'); // this is actually
var $table = $('#dataTable_' + entry.id); // i need something like this
}
headColumnWidth(){
var $table = $('table.scrolling-table'); // this is actually
var $table = $('#dataTable_' + entry.id); // i need something like this
}
$(function() {
bodyColumnWidth();
headColumnWidth();
});
$(window).resize(function() {
bodyColumnWidth();
headColumnWidth();
}).resize();
</script>