我正在尝试根据组合框选择更新/重新加载数据表。我的组合框选择器工作正常,隐藏/显示我想要的元素。
但是,当我尝试更新api_url参数时,它保持不变。它在我的最终console.log()
语句中也显示为未定义。
<body onload="viewChange(1)">
<div id="grid" style="width: 100%; height: 100%;">
<script type="text/javascript" charset="utf-8">
var api_url;
function viewChange(value){
if (value == 8){
$$("devicesToolbar").show();
$$("accountsToolbar").hide();
webix.message("Value was changed "+value)
api_url = "inc/template.php?list=device_list";
}
else if (value == 1) {
console.log(value);
$$("devicesToolbar").hide();
$$("accountsToolbar").show();
webix.message("Value was changed "+value);
api_url = "inc/template.php?list=all_accounts";
}
else {
webix.message("Value was changed "+value);
}
};
console.log(api_url);
</script>
</div>
</body>
编辑:
这是我的数据表UI代码。我需要使用该函数更新onmy combobox更改。是否有一种优雅的方式来做到这一点?
webix.ui({
container:"grid",
rows:[
{
view:"datatable",
select:"row",
url: api_url,
scrollY: true,
scrollX: true,
columns:[
{ id:"project_name", header:"Project Name", css:"rank", adjust:true, sort: "text"},
{ id:"company_name", header:"Company Name", adjust:true, sort:"text"},
{ id:"created_date", header:"Date Created", adjust:true, sort:"text"},
{ id:"weeks_in_cert", header:"Account Age", width:175, sort:"int"},
{ id:"account_id", header:"Account ID", adjust:true, sort:"text"},
{ id:"api_key", header:"API Access Key", adjust:true},
{ id:"certified", header:"Certified?", adjust:true, sort:"text"},
{ id:"certified_date", header:"Date Certified", adjust:true, sort:"text"},
{ id:"contact_name", header:"Contact Name", adjust:true, sort:"text"},
{ id:"contact_email", header:"Contact E-Mail", adjust:true, sort:"text"},
{ id:"contact_phone", header:"Contact Phone", adjust:true, sort:"text"},
{ id:"card_processor", header:"Test Processor", adjust:true, sort:"text"},
{ id:"client_type", header:"Client Type", adjust:true, sort:"text"},
{ id:"authorization_date", header:"Last Transaction", adjust:true, sort:"text"},
{ id:"api_version", header:"API Version", adjust:true, sort:"text"},
{ id:"industry_type", header:"Industry Type", adjust:true, sort:"text"},
{ id:"terminal_number", header:"Terminal Number", adjust:true, sort:"text"},
{ id:"additional", header:"Additional Account?", adjust:true, sort:"text"},
],
}
]
});