如何在flexigrid中动态重新定义列?
我尝试了以下内容:
model = [{ .../*some new columns model*/ } ];
target.flexOptions({colModel: model});
target.flexReload();
没有运气:/
答案 0 :(得分:3)
我遇到了同样的问题。
我能做的就是为flexigrid的div创建一个包装器div,并在每次需要更改colmodel时清空包装器/重新创建flexigrid。类似的东西:
$("#flexigridContainer").empty();
$("#flexigridContainer").append($("<div>").attr("id", "reporteFlexigrid"));
var report = $("#cmbValReports option:selected").attr("value");
var colModel;
switch(report){
case 1: url = ""; colModel = abonosFlexigridModel(); break;
case 2: url = ""; colModel = cgeneralFlexigridModel(); break;
case 3: url = ""; colModel = cccostoFlexigridModel(); break;
case 4: url = ""; colModel = prestamoFlexigridModel(); break;
}
initFlexigrid(url, colModel);
initFlexigrid就像
function initFlexigrid(purl, pcolModel){
$("#reporteFlexigrid").flexigrid({url: purl, colModel: pcolModel, ... }); }
它对我有用: - )
答案 1 :(得分:0)
试试这个
model = [{ .../*some new columns model*/ } ];
$('#flex').flexOptions(model).flexReload();