I am displaying data list as shown below:
<div class="my-table" data-bind="if:(dataList() && dataList().length)">
//render data raw here...
I am new to ko and looking to refresh this list without reloading the page, is this something possible with knockout?
I believe i can add new items to the list using something like applyBindingsToNode
, but looking for a way to refresh the entire list as there are some refreshed numbers on one of the column.
You seem to be unclear on the basics of Observable Arrays.
You can assign a new array value to dataList
by passing the array as an argument: dataList(['one', 'two', 'three'])
;
You can modify the contents of dataList
using most of the usual array-updating functions: push, pop, shift, unshift, reverse, and sort. There are also replace and remove functions, which are not standard array-updating functions.
Any updates you make to dataList
using these methods will be reflected in your view, assuming your commented "render data raw here" section makes use of dataList
.