3

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

Imdad
  • 5,942
  • 4
  • 33
  • 53
Ashwin
  • 12,081
  • 22
  • 83
  • 117
  • try `resizable: false` refer to http://www.kenthouse.com/blog/2009/07/fun-with-flexigrids/ – Imdad May 16 '12 at 09:27
  • I just checked it. It enables/disables resizing of the whole grid, not columns. – Ashwin May 16 '12 at 09:27
  • Then I think there no option in flexigrid to resize column. I have created an issue here https://github.com/paulopmx/Flexigrid/issues/9 keep track of it if they resolve it. – Imdad May 16 '12 at 09:43
  • cool. Thanks. I used @Nildarar method and it worked. – Ashwin May 16 '12 at 09:52
  • Good. Does it worked without modification? If so I'll use the same method if needed in future – Imdad May 16 '12 at 09:53
  • 1
    yes. It worked without modification. Though there were few css related problems which were minor and I tweaked them according to my needs. – Ashwin May 16 '12 at 10:17

2 Answers2

4

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.

Nildarar
  • 802
  • 1
  • 8
  • 17
1

colResize: false property will disable the option.

pinku
  • 1,139
  • 2
  • 9
  • 25