ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Flexigrid - Lightweight but rich data grid

March 28, 2008 10:13am

Subscribe [82]
  • #481 / Jul 21, 2008 4:28am

    justinkelly

    5 posts

    Hi Guys,

    first - thanks for the great flexigrid!!
    - i was starting to use extgrid but this is a nicer option

    just a quick question for you guys
    - is it possible to set the column width in % rather than px in flexigrid?
    - i’ve had a play around and looked in the flexigrid.js etc. but couldn’t see anything

    Cheers

    Justin

  • #482 / Jul 21, 2008 11:41am

    TheJayL

    18 posts

    Ok I found a major issue with my code.  The grid breaks when I include an ajax function that I created.  When I reorder the columns: Basically at the end of DragEnd I call my ajax function to store the new column order.  Everything seems to look and work fine and my code writes out the sessions vars.  If I reload the page it stays the way I left it.

    However, if I use any of the grids functions like next page or change the rows per page or show/hide columns (basically anything the grid reloads the data but not the whole page) I get errors in the grid.  They all are linked to this one action of mine.  The biggest error is that the grid populates, but with the old column order.  The headers are still correct, but the actual data is not.  So my columns are not matching up.  Once I reload, everything looks and operates as it should until I use one of the built in Flexi operations again.

    This makes me think either the JS is taking care of managing its own column layout, independent of the XML, or my ajax command is somehow breaking the JS and not allowing it to update itself.  Once I take out the Ajax it all works great.

    I have also checked the XML after the columns have been reordered and it is correct, and I have “alerted” the column titles after the Grid populates, both are correct.  My leaning towards something going haywire in this like of code, but not sure:

    td[removed] = $(“cell:eq(”+ idx +”)”,robj).text(); 

    Any ideas as to where to look would be great.

  • #483 / Jul 21, 2008 8:34pm

    justinkelly

    5 posts

    re

    Hi Guys,

    first - thanks for the great flexigrid!!
    - i was starting to use extgrid but this is a nicer option

    just a quick question for you guys
    - is it possible to set the column width in % rather than px in flexigrid?
    - i’ve had a play around and looked in the flexigrid.js etc. but couldn’t see anything

    Cheers

    Justin

    to try and make this work i edited flexigrid.js and changed it from px to % (refer below)
    ############
    line 960 $(thdiv).css({textAlign:this.align, width: this.width + '%'});
    ############

    the outcome of this is that the div widths for the columns now show up as %

    grid html
    #### TH ####
    <th class=“sorted” align=“center” abbr=“id” axis=“col0”>
    <div class=“sasc” [removed]>ID</div>
    </th>
    #### TD ####
    <td class=“sorted” align=“center”>
    <div [removed]>1</div>
    </td>

    but this didn’t work/display correctly - anyone got any suggestions on how to make column % width work?

    Cheers

    Justin

  • #484 / Jul 22, 2008 7:47am

    Kevin Kietel

    22 posts

  • #485 / Jul 22, 2008 12:14pm

    tof

    3 posts

    hello,
    i’m going to use flexigrid for my new programs.
    however, i would like to dynamically parse the grid’s attributes to add new functions to the grids (printing, csv output, etc).
    i’ve passed the all day trying to get the colModel definition but i didnt succeed.
    i want to get the colModel definition, the sortname & sortorder attributes, in javascript, so that i can generate the sql command coresponding to the user choices once he had played with the grid appearance…
    maybe someone here can help me ?

  • #486 / Jul 22, 2008 11:32pm

    Very nice datagrid! My compliments. Two issues, tho - one I can solve, one I’m having trouble with:

    1) In the demo and on one place in flexigrid.js, you refer to showTableToggleBtn. Most places refer to - what I assume is the same thing - with showToggleBtn. I changed the reference within flexigrid.js, and set showToggleBtn parameter in setup call (to false).

    2) Semi-related…I didn’t want the showToggleBtn (checkboxes for columns, if I’m correct), and thus turned off showToggleBtn by setting it to false. However, this triggers a JS error. In Firebug, when I hover over a column heading (and the button would normally appear), I get:
    Node cannot be inserted at the specified point in the hierarchy” code: “3
    [Break on this error] this.appendChild( a );

    Everything still works regardless, but I wish I could get rid of these errors…Ideas, Paulo?
    Thanks -

  • #487 / Jul 23, 2008 12:50am

    In reply to my own prior post…

    Apparently, showTableToggleBtn and showToggleBtn are distinct. Thus, there should be a showTableToggleButton default in parameters at top of flexigrid.js.

    Further, to address the JS error mentioned when hover over header column name when showToggleBtn is false:
    Node cannot be inserted at the specified point in the hierarchy” code: “3
    [Break on this error] this.appendChild( a );

    I fixed this, tho probably not optimally, by two edits in flexigrid.js:

    Comment out/change:

    //            if (p.showToggleBtn) $(g.gDiv).prepend(g.nBtn);
                $(g.gDiv).prepend(g.nBtn);

    Wrap an ‘if’ around hover processing:

    if (p.showToggleBtn) // DLC patch
    {
      (g.nDiv).hide();$(g.nBtn).hide();
      $(g.nBtn).css({'left':nl,top:g.hDiv.offsetTop}).show();
      var ndw = parseInt($(g.nDiv).width());
      $(g.nDiv).css({top:g.bDiv.offsetTop});
      if ((nl+ndw)>$(g.gDiv).width())
        (g.nDiv).css('left',onl-ndw+1);
      else
        $(g.nDiv).css('left',nl);
      if ($(this).hasClass('sorted')) 
        $(g.nBtn).addClass('srtd');
      else
        $(g.nBtn).removeClass('srtd');
    }
  • #488 / Jul 23, 2008 12:01pm

    Armorfist

    121 posts

    re

    Hi Guys,

    first - thanks for the great flexigrid!!
    - i was starting to use extgrid but this is a nicer option

    just a quick question for you guys
    - is it possible to set the column width in % rather than px in flexigrid?
    - i’ve had a play around and looked in the flexigrid.js etc. but couldn’t see anything

    Cheers

    Justin

    to try and make this work i edited flexigrid.js and changed it from px to % (refer below)
    ############
    line 960 $(thdiv).css({textAlign:this.align, width: this.width + '%'});
    ############

    the outcome of this is that the div widths for the columns now show up as %

    grid html
    #### TH ####
    <th class=“sorted” align=“center” abbr=“id” axis=“col0”>
    <div class=“sasc” [removed]>ID</div>
    </th>
    #### TD ####
    <td class=“sorted” align=“center”>
    <div [removed]>1</div>
    </td>

    but this didn’t work/display correctly - anyone got any suggestions on how to make column % width work?

    Cheers

    Justin

    Did anyone figure this out? I’m trying to do this too but without success. Getting really frustrated 😛
    Thanks

  • #489 / Jul 23, 2008 12:23pm

    Armorfist

    121 posts

    Oh and paulo:

    In the next release can you include the string “Quick Search” and “Clear” from the search box feature as a property like “pagestat”?
    I have to manually change this in every release

    Thanks!

  • #490 / Jul 23, 2008 11:03pm

    Wallcrawler

    3 posts

    Hi guys!

    First of all, flexigrid is a superb jquery plugin!

    But i´m facing some troubles to get it work perfectly.

    Please see the page http://www.goldmaxbrasil.com.br/desenvolvimento/sisfinanceiro/lanc_financ/contas_pagar_quitacao.asp, and click in “mostrar” button.

    The flexgrid is shown, but the margin of each header didn’t match with the rows. If you access this page using IE7 more visual problems is shown. What have i done wrong?

    Otherwise, how can i put a function to be executed when the user select one row?

    Thank you!

  • #491 / Jul 24, 2008 5:20am

    paulopmx

    164 posts

    re

    Hi Guys,

    first - thanks for the great flexigrid!!
    - i was starting to use extgrid but this is a nicer option

    just a quick question for you guys
    - is it possible to set the column width in % rather than px in flexigrid?
    - i’ve had a play around and looked in the flexigrid.js etc. but couldn’t see anything

    Cheers

    Justin

    to try and make this work i edited flexigrid.js and changed it from px to % (refer below)
    ############
    line 960 $(thdiv).css({textAlign:this.align, width: this.width + '%'});
    ############

    the outcome of this is that the div widths for the columns now show up as %

    grid html
    #### TH ####
    <th class=“sorted” align=“center” abbr=“id” axis=“col0”>
    <div class=“sasc” [removed]>ID</div>
    </th>
    #### TD ####
    <td class=“sorted” align=“center”>
    <div [removed]>1</div>
    </td>

    but this didn’t work/display correctly - anyone got any suggestions on how to make column % width work?

    Cheers

    Justin

    Did anyone figure this out? I’m trying to do this too but without success. Getting really frustrated 😛
    Thanks

    Hi guys,

    I didn’t really design flexigrid to use % sizes as the dragndrop and resizing functions are dependent on accurate per pixel measurements.

    Paulo

  • #492 / Jul 24, 2008 5:22am

    paulopmx

    164 posts

    Oh and paulo:

    In the next release can you include the string “Quick Search” and “Clear” from the search box feature as a property like “pagestat”?
    I have to manually change this in every release

    Thanks!

    Sure, no problem, someone also suggested the post variables can be renamable as well, i’ll publish these two updates together.

  • #493 / Jul 24, 2008 5:39am

    paulopmx

    164 posts

    Ok I found a major issue with my code.  The grid breaks when I include an ajax function that I created.  When I reorder the columns: Basically at the end of DragEnd I call my ajax function to store the new column order.  Everything seems to look and work fine and my code writes out the sessions vars.  If I reload the page it stays the way I left it.

    However, if I use any of the grids functions like next page or change the rows per page or show/hide columns (basically anything the grid reloads the data but not the whole page) I get errors in the grid.  They all are linked to this one action of mine.  The biggest error is that the grid populates, but with the old column order.  The headers are still correct, but the actual data is not.  So my columns are not matching up.  Once I reload, everything looks and operates as it should until I use one of the built in Flexi operations again.

    This makes me think either the JS is taking care of managing its own column layout, independent of the XML, or my ajax command is somehow breaking the JS and not allowing it to update itself.  Once I take out the Ajax it all works great.

    I have also checked the XML after the columns have been reordered and it is correct, and I have “alerted” the column titles after the Grid populates, both are correct.  My leaning towards something going haywire in this like of code, but not sure:

    td[removed] = $(“cell:eq(”+ idx +”)”,robj).text(); 

    Any ideas as to where to look would be great.

    Hi,

    Ok the ordering works like this: at initial setup, the ordering of columns is base on the order of your colModel, and stored on the axis attribute. This must then be match by your backend. Now once the user reorders the columns and data is repopulated, the script looks at your old order and base the ordering through that.

    Now to using your session vars, dynamically order the loading of the colModel using PHP base on your session vars, and on the backend dynamically order the columns base on your session vars as well.

    Paulo

  • #494 / Jul 24, 2008 5:44am

    paulopmx

    164 posts

    hello,
    i’m going to use flexigrid for my new programs.
    however, i would like to dynamically parse the grid’s attributes to add new functions to the grids (printing, csv output, etc).
    i’ve passed the all day trying to get the colModel definition but i didnt succeed.
    i want to get the colModel definition, the sortname & sortorder attributes, in javascript, so that i can generate the sql command coresponding to the user choices once he had played with the grid appearance…
    maybe someone here can help me ?

    I actually don’t understand why you need the grid’s attributes to add new functions of (printing, csv output, etc).

    But to get the attributes try this custom api method

    $.fn.flexAttr = function(p) {
    
            return this.each( function() {
                    if (this.grid) return this.p;
                });
    
        };
  • #495 / Jul 24, 2008 5:46am

    paulopmx

    164 posts

    Hi guys!

    First of all, flexigrid is a superb jquery plugin!

    But i´m facing some troubles to get it work perfectly.

    Please see the page http://www.goldmaxbrasil.com.br/desenvolvimento/sisfinanceiro/lanc_financ/contas_pagar_quitacao.asp, and click in “mostrar” button.

    The flexgrid is shown, but the margin of each header didn’t match with the rows. If you access this page using IE7 more visual problems is shown. What have i done wrong?

    Otherwise, how can i put a function to be executed when the user select one row?

    Thank you!

    Can’t access your link. But it could be a CSS conflict problem.

    for single select, use the new option { singleSelect: true } when creating your flexigrid.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases