Redefine/Reset columns in flexigrid?
how to dynamically redefine columns in flexigrid?
i have tried the followings:
model = [{ .../*some new columns model*/开发者_运维百科 } ];
target.flexOptions({colModel: model});
target.flexReload();
without any luck :/
I just had this same problem.
The bes I could do was create a wrapper div for the flexigrid's div and empty the wrapper/recreate the flexigrid everytime I needed to change the colmodel. Something like:
$("#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);
And the initFlexigrid was something like
function initFlexigrid(purl, pcolModel){
$("#reporteFlexigrid").flexigrid({url: purl, colModel: pcolModel, ... }); }
It worked for me :-)
try this
model = [{ .../*some new columns model*/ } ];
$('#flex').flexOptions(model).flexReload();
精彩评论