开发者

Redefine/Reset columns in flexigrid?

开发者 https://www.devze.com 2023-01-13 23:28 出处:网络
how to dynamically redefine columns in flexigrid? i have tried the followings: model = [{ .../*some new columns model*/开发者_运维百科 } ];

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消