I am working on tizen web app by using caphList. I am using ajax to fetch data from api and after getting response I set in caphlist by this code:
// Reset container before set data
$('#sub_cate_list').html("");
$('#sub_cate_list').caphList({
items : items,
template: 'sub-cate-template',
containerClass : 'list',
direction: 'vertical',
initialItemIndex: 0,
onFocusItemView: function(context) {
// Assign inner category index
SUB_CAT_INDEX = {rowIndex: context.rowIndex, itemIndex: context.itemIndex};
}
});
Before setting data in caphlist i am using html() method of jquery to reset the container and it’s working fine But when i click on another category to load same ui but new category data then focus in not working.
Code to set focus:
$.caph.focus.activate();
let controllerProvider = $.caph.focus.controllerProvider.getInstance();
controllerProvider.setDepth(0);
controllerProvider.focus(0);
So i think destroy method of caphlist will work but i do not know how to use this. So could someone please suggest how to use destroy method?
If anyone think I am not doing in right way please suggest.
Simply i want to use same template with new data.
Thanks