Closed Gbeschbacher closed 8 years ago
Are those two tables in different views (if you are using router) or in the same view? Are they in different tabs but in the same view?
i don't know if i can fully understand your point but these are 2 completly seperated views with no knowledge of each other actually.
any more code needed which would help you to understand my problem?
thanks already for the very fast reply!
EDIT1: sorry - just saw that the router still said patientAdd and patientOverview and the jade files have been file 1 and file 2 - they correspond to either one
Mmmh maybe you might need to set the attribute autoWidth
to false
.
See this plnkr for example.
no difference - anything else i could try out?
EDIT1: if it helps i could send you a collaboration invitation to my private-repository
I believe I have the same issue as described above. It seems that the wrong (previous) instance of datatables is being used. If I manually run DTInstances.getLast() after the table has been initialized, I do get the correct instance but it is being set as the previous upon initial load
EDIT: I have implemented a workaround for the time being by creating a recursive function that grabs the latest DTInstance upon controller initialization (or in my case after the datatables directive has had a chance to initialize)
function getDTInstance(newVal) {
$timeout(function () {
DTInstances.getLast().then(function (dtInstance) {
if (newVal == dtInstance) {
$scope.dtData.dtInstance = dtInstance; //or whatever
}
else {
getDTInstance(dtInstance);
}
});
});
}
In my case, I have an ngIf directive on the datatables directive and so this function is called after the ngIf condition is set to true. Typically, the first time it executes newVal is undefined, the second time newVal is equal to the datatables instance from the previous controller that implemented a datatable, and the third is typically the correct instance.
I imagine that if any of these DTInstances functions are executed upon controller initialization that we may indeed get a previous instance as well even without using ngIf on the directive
Can you explain why you closed this? We are also getting the same issue.
Because I do not reproduce this issue and I do really know where the issue is really.
As for the comment of @Saabertooth, it should be fixed with the newest versions as DTInstance.getLast
is replaced by providing the object/callback directly in the HTML.
For @Gbeschbacher's project, unfortunately, I do not really use jade and I couldn't really run his application.
But you are right, I'll keep it open and it will be better if there is a plnkr or something alike that reproduces the issue.
I also met the same question! two datatable instances in one view(two tab-pages). I set the width on tr th with 10%, but it didnt work. And I had try to set .withOption('autoWidth', false) .withOption('responsive', true); It had been solved!
Heyo,
I am using datatables in 2 different locations with 2 different controllers and options. Nevertheless the second table doesn't work at all as expected. Following is my code and afterwards my issue explained:
Following are my 2 different HTML Files (in Jade) with the datatables
And in case it helps for any advices or solutions, here is my app.js file of angular
This code produces following issue: The first table is rendering as expected with working responsive and bootstrap and un-sortable columns etc. The second table is not responsive anymore at all but still uses bootstrap and set the specified columns as un-sortable including the correct language. An interesting thing now is, that if i completly leave out the options and column-defs for the second table, it is still responsive and keeps the columns un-sortable which i specified for table 1 but bootstrap and language-settings are completly missing.
Am i doing something wrong here? Please help! Every advice or possible solution is appreciated