I'm writing an app in ember using jQuery Datatables and I've got a deprecation, here is my code:
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement()
{
var selected1 =new Array();
var table = this.$('#example').DataTable
({
"bAutoWidth": false,
"responsive":true,
"ajax": '/lens',
"columns":
[
{ "data": "id" },
{ "data": "type" },
{ "data": "sizeA" },
{ "data": "sizeB" },
{ "data": "sizeC" },
{ "data": "sizeD" },
{ "data": "comment" },
{ "data": "date" },
{ "data": "job" },
{ "data": "test" },
{ "data": "result" },
],
"language":
{
//translation to Polish
processing: "Przetwarzanie...",
search: "Szukaj:",
lengthMenu: "Pokaż _MENU_ pozycji",
info: "Pozycje od _START_ do _END_ z _TOTAL_ łącznie",
infoEmpty: "Pozycji 0 z 0 dostępnych",
infoFiltered: "(filtrowanie spośród _MAX_ dostępnych pozycji)",
infoPostFix: "",
loadingRecords: "Wczytywanie...",
zeroRecords: "Nie znaleziono pasujących pozycji",
emptyTable: "Brak danych",
paginate:
{
first: "Pierwsza",
previous: "Poprzednia",
next: "Następna",
last: "Ostatnia"
},
aria:
{
sortAscending: ": aktywuj, by posortować kolumnę rosnąco",
sortDescending: ": aktywuj, by posortować kolumnę malejąco"
},
},
});
new $.fn.dataTable.Buttons( table,
{
buttons:
[
{
text: 'Odśwież',
action: function ( e, dt, node, config )
{
table.ajax.reload( null, false );
}
}
]
} );
table.buttons().container()
.appendTo( $('.col-sm-6:eq(0)', table.table().container() ) );
$('#example tbody').on( 'click', 'tr', function ()
{
$(this).toggleClass('selected');
selected1.push(table.row(this).data().id);
});
$(this).toggleClass('selected');
this.set('selected',selected1);
},
});
And here is the deprecation:
DEPRECATION: A property of lista-soczewek-frontend@view:-outlet::ember400
was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.
[deprecation id: ember-views.dispatching-modify-property] at logDeprecationStackTrace (http://ift.tt/2aIyaVF) at HANDLERS.(anonymous function) (http://ift.tt/2aHi2R9) at raiseOnDeprecation (http://ift.tt/2aIyCmG) at HANDLERS.(anonymous function) (http://ift.tt/2aHi2R9) at invoke (http://ift.tt/2aHiP4t) at deprecate (http://ift.tt/2aIyELo) at Object.deprecate (http://ift.tt/2aHiqPx) at Class.exports.default._emberMetalMixin.Mixin.create._Mixin$create.scheduleRevalidate (http://ift.tt/2aIyHXE) at http://ift.tt/2aHjDpN
What can I do in that case? How to eliminate the deprecation?
Greetings, Rafał
Aucun commentaire:
Enregistrer un commentaire