我尝试了https://stackoverflow.com/users/1140893/tabalin?tab=profile中提到的tabalin(Update select dropdown list on filtering js-grid data)的解决方案。但它会刷新所有标题行列。并且先前选择的值将重置为默认值。请提出一种解决方案,以刷新特定的下降物品清单。
我尝试如下。
var select=$(".jsgrid-insert-row").find("select");
$(select[3]).on('change',function(event){
var parent=$(this).val();
db.childactivities = [
{ Name: "-select-", Id: 0 },
];
if(parent!=0)
{
$.each(db.allactivities,function(key,value) {
if(value.parentaid==parent)
{
db.childactivities.push({Name:value.Name,Id:value.Id});
}
});
}
$("#jsGrid").jsGrid("fieldOption", "Specific Activities", "items", db.childactivities);
});