Does not want to resize columns in Flexigrid

2019-07-21 08:26发布

问题:

I want to disable column resizing in Flexigrid.
Is there any option like colresize:false/true ? I could not find any.

回答1:

I found this:

change beginning of dragStart to:

if (dragtype=='colresize' && p.colResize == true) //column resize
{
    $(g.nDiv).hide();$(g.nBtn).hide();
    var n = $('div',this.cDrag).index(obj);
    var ow = $('th:visible div:eq('+n+')',this.hDiv).width();
    $(obj).addClass('dragging').siblings().hide();
    $(obj).prev().addClass('dragging').show();
    this.colresize = {startX: e.pageX, ol: parseInt(obj.style.left), ow: ow, n : n };
    $('body').css('cursor','col-resize');
    //cleanup
    n=null;
    ow=null;
}

To make it cleaner you can add a property to pass in like colResize:true, but set colResize:false as a default in flexigrid. And then check p.colResize == true to enable resizing. This way you can have it both ways when needed. Just an idea.



回答2:

colResize: false property will disable the option.