I have 2 DataTables.
One loads data externally, other synced with it with a filter.
Case nr 1)
If I create an onItemClick event which contains an instruction to refresh() or updateitem() the items in second DataTable are not selected anymore.
Case nr 2)
if I create an onAfterSelect i’m able to select item in second DataTable, but if I try to get selected item($$(“name”).getSelectedItem()) or clear the selection($$(“name”).clearSelection()) when I click back on the first DataTable it doesn`t work at all. Selected Item = null and clearSelection have no effect.
Case nr 3)
If I refresh second datatable from first everything works fine.
Case nr 4)
If I remove the filter everything works just fine
Please see the code bellow:
JS:
var matchingDataTable = {id:“match-datatable”,
view:“datatable”,
url:"/staff/index.php?/p1settings/P1Settings/AJAXOrganizations",
height:700,
autowidth:true,
autoConfig:true,
select:“row”,
columns:[
{id:“orgname”,header:“Organization Name”,width:250},
{id:“statusname”,header:“Status”,width:120}
]
};
var nableDataTable = {id:“nable-clients”,
view:“datatable”,
autoConfig:true,
autowidth:true,
select:“row”,
columns:[
{id:“orgname”,header:“Nable Organization Name”,width:250}
]
};
var tabs_ui = {“view”:“tabview”,
“type”:“wide”,
“tabbar”:{“optionWidth”:250},
“container”:“config”,
“minWidth”:1073,
“cells”:[
{“header”:“Organizations Match”,
“body”:{
“cols”:[
matchingDataTable,
nableDataTable
]
}
}
]
};
var logic = {
init: function () {
$$(“nable-clients”).attachEvent(“onItemClick”,
function (id, e, node) {
$$(“nable-clients”).refresh();
$$(“match-datatable”).refresh();
});
$$(“nable-clients”).data.sync($$(“match-datatable”).data, function () {
this.filter(function (data) {
return data.kayako == null;
});
});
$$(“match-datatable”).attachEvent(“onItemClick”,
function (id, e, node) {
console.log($$(“nable-clients”).getSelectedItem());
$$(“nable-clients”).refresh();
});
}
};
html: