TypeError cyclic object value when trying to change a ko.observable from an jquery trigger inside jquery DataTables -
i'm trying change ko.observable value when clicking on jquery.datatables table-row id of row. i'm instantiating datatable in durandal's attached function after fetched data server in activate cycle. without on-click logic, can't change observable value after instantiated datatable.
code below:
self.attached = function(view, parent) { self.selectedcategory().schedule_id(1337); self.dt = $('#reservation_schedule_table').datatable(); } works fine. but, when write this,
self.attached = function(view, parent) { self.dt = $('#reservation_schedule_table').datatable(); self.selectedcategory().schedule_id(1337); } i cyclic object error.
typeerror: cyclic object value return json.stringify(ko.utils.unwrapobservable(data), replacer, space); knockou...7981312 (line 537, col 19) can tell me why , how prevent happening?
i think got it. because thing that's being returned module new instance of viewmodel itself, datatable instance had relative view-parameter of attached function. haven't understood why is, yet. i'm going read on it. starters, how code should like:
self.attached = function(view, parent) { view.dt = $('#reservation_schedule_table').datatable(); self.selectedcategory().schedule_id(1337); } and wherever datatable used inside 1 of lifecycle functions, has view.dt
Comments
Post a Comment