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]
  • #301 / May 11, 2008 10:39am

    adwin

    77 posts

    Hello. First I have to say - what an incredible control! This is absolutely great!

    Second, what would be the easiest way for me to call an onclick event to show the current id of the row?

    I am basically just needing a quick alert box displaying the current row that has been clicked.

    Thanks!

    It would be easier if you assign onclick using ajax processing.
    I won’t rely on flexigrid api for assigning it.

  • #302 / May 11, 2008 12:39pm

    swhitlow

    22 posts

    Hello. First I have to say - what an incredible control! This is absolutely great!

    Second, what would be the easiest way for me to call an onclick event to show the current id of the row?

    I am basically just needing a quick alert box displaying the current row that has been clicked.

    Thanks!

    It would be easier if you assign onclick using ajax processing.
    I won’t rely on flexigrid api for assigning it.

    adwin - thanks for the reply! Could you provide a quick example of this?  I had tried to do this with just a

    $(”#flexigrid”).click( function() {
    alert("test");
    });

    But, it did not seem to work. Any help would be greatly appreciated!  Thanks!

  • #303 / May 11, 2008 1:05pm

    adwin

    77 posts

    adwin - thanks for the reply! Could you provide a quick example of this?  I had tried to do this with just a

    $(”#flexigrid”).click( function() {
    alert("test");
    });

    But, it did not seem to work. Any help would be greatly appreciated!  Thanks!

    I won’t use that way ... I prefer to render the onclick directly like this

    <?php
    .... 
    $counter = 0 
    foreach($results as $data){
    .... // do whatever you want here ... 
    $links = "<a href='#' class='myclass' onclick='dosomething($counter);'> test </a>";
    ... // do anything else .. produce json data ? 
    $counter++;
    }
    ...
    ?>

    but if you still prefer the jquery event style ... i would recommend you to use attr.

    <?php
    // change above with 
    $links = "<a href="#" class='myclass'> test </a>";
    ?>
    
    and use jquery like this 
    $(".myclass").click( function() {
         alert($(this).attr('callerid')); 
    });

    I won’t mess the flexigrid.js library because when it updated I don’t want to change my codes 😊

  • #304 / May 11, 2008 1:35pm

    adwin

    77 posts

    Another way ... tested 😊
    #flex1 = is my table id ($(’#flex1’).flexigrid();)

    $('.flexigrid #flex1 tr').each(
    function(x){
    $(this).bind('click',function(){alert($(this).attr('id'));});
    });

    or ... getting more fun ?

    $('.flexigrid #flex1 tr').each(
        function(x){
            $(this).bind('click',
                function(){
                    className = $(this).attr('class');               
                    if(className.indexOf('trSelected') != -1){
                        alert('selected on id ' + $(this).attr('id'));
                    } else
                    {
                        alert('unselected on id ' + $(this).attr('id'));
                    }
                });
    });

    the code has bug, if the class is empty, attr() will return undefined .... weird ?
    jquery’s bug or it just a common ?

  • #305 / May 12, 2008 8:36am

    Roberto Miguez

    14 posts

    Hey, I need a help!

    I have a database that returns a xml response to populate the grid. Works fine on IE but I got an error on Firefox. I saw that I receive the answer from database correctly (I put an alert in addData function) but the data doesn’t show on table. I receive this message: “Displaying NaN to NaN of undefined items”.

    The structure of my table is JSON and the data that comes from database is XML. Anyone know how to solve this? I tried but I don’t know what to do more.

    Thank you!

  • #306 / May 12, 2008 10:26am

    somemilk

    7 posts

    Paulo, if you read this, don’t you think it would be better to use “button” tag for the “clear” in quick search instead of input type=“button”? That would make it easier to style buttons and input fields separately.
    Anyway thanks for the great control!

  • #307 / May 12, 2008 1:27pm

    stevefdotnet

    1 posts

    Hi Paulo,
    Much qudos for this widget. I have a couple of needs and I wonder if you are scheduled to implement them.
    I need the ability to select columns (like in excel) the default action is to sort by that column but it would be great to select the column, not sure if you could add a checkbox to the header.
    Another need is the ability to have static columns. Not just fixed width but static so that when the grid scrolls from left to right the columns stay put. This of course would mean a complete redesign of the html output for the grid as you could no longer have one large table.
    If anyone has attempted a similar thing it would be great to see an implemntatio, if not I guess my fingers are gonna have to get dirty!!!

    Cheers

  • #308 / May 12, 2008 1:34pm

    Bryancan

    1 posts

    I notice the ‘json’ required for flexigrid is very non standard… (the xml too)

    {
    page: 1,
    total: 239,
    rows: [
    {id:'AD',cell:['AD','ANDORRA','Andorra','AND','20']},
    {id:'AE',cell:['AE','UNITED ARAB EMIRATES','United Arab Emirates','ARE','784']},
    {id:'AF',cell:['AF','AFGHANISTAN','Afghanistan','AFG','4']},
    {id:'AG',cell:['AG','ANTIGUA AND BARBUDA','Antigua and Barbuda','ATG','28']},
    {id:'AI',cell:['AI','ANGUILLA','Anguilla','AIA','660']},
    {id:'AL',cell:['AL','ALBANIA','Albania','ALB','8']},
    {id:'AM',cell:['AM','ARMENIA','Armenia','ARM','51']},
    {id:'AN',cell:['AN','NETHERLANDS ANTILLES','Netherlands Antilles','ANT','530']},
    {id:'AO',cell:['AO','ANGOLA','Angola','AGO','24']},
    {id:'AQ',cell:['AQ','ANTARCTICA','Antarctica','','']},
    {id:'AR',cell:['AR','ARGENTINA','Argentina','ARG','32']},
    {id:'AS',cell:['AS','AMERICAN SAMOA','American Samoa','ASM','16']},
    {id:'AT',cell:['AT','AUSTRIA','Austria','AUT','40']},
    {id:'AU',cell:['AU','AUSTRALIA','Australia','AUS','36']},
    {id:'AW',cell:['AW','ARUBA','Aruba','ABW','533']}]
    }

    any way to get it to take a more normal format? Like what JSONObject.java outputs as suggested from json.org?


    http://json.org/object.gif
    json example


    EDIT:

    I’m able to generate json format like the above, BUT I have built this into a portlet (LifeRay) and for some reason when I call this code behind as a struts action it wraps my result with a <DIV> tag that makes the grid not work… any help on making flexigrid ignore the div wrapper and just process the json result inside?

    Thanks.

  • #309 / May 12, 2008 2:24pm

    frantic

    3 posts

    First off, I’ve started using Flexigrid a while ago, and am very impressed. Great job Paulo!

    I am currently trying to customize it in a unique way, and was wondering if anyone could give me some advice.

    So, this is the situation… I am calling a dynamic XML file via AJAX to populate the grid. The XML looks something like the sample below. The output can sometimes include links. However, right now all I get is the values of the ‘uri’ and ‘name’ nodes as text.

    My question is, how do I create a link based on my XML file? (I would really appreciate any hints that involve only changing flexigrid.js and/or the addition of jQuery code.)


    Thanks.

     

    XML file

    <grid>
    
        <row>
    
            <cell>
                <link>
                    <name>test</name>
                    <uri>test/testing.index</uri>
                </link>
            </cell>
    
        </row>
    
    </grid>
  • #310 / May 12, 2008 11:52pm

    newbie_CI

    1 posts

    Hi Forum,

    I’m new to the whole CI and has downloaded the flexigrid.  It’s is awesome.  I been playing around with it and wondering how do I get my text wrap within the cell.  I have a long text in some of my database fields and would like the text to wrap within the cell.  Any help would be greatly appreciated.

    Thanks

  • #311 / May 15, 2008 10:28pm

    paulopmx

    164 posts

    Hi Forum,

    I’m new to the whole CI and has downloaded the flexigrid.  It’s is awesome.  I been playing around with it and wondering how do I get my text wrap within the cell.  I have a long text in some of my database fields and would like the text to wrap within the cell.  Any help would be greatly appreciated.

    Thanks

    just add this to the parameters of your flexigrid

    nowrap: false
  • #312 / May 15, 2008 10:34pm

    paulopmx

    164 posts

    First off, I’ve started using Flexigrid a while ago, and am very impressed. Great job Paulo!

    I am currently trying to customize it in a unique way, and was wondering if anyone could give me some advice.

    So, this is the situation… I am calling a dynamic XML file via AJAX to populate the grid. The XML looks something like the sample below. The output can sometimes include links. However, right now all I get is the values of the ‘uri’ and ‘name’ nodes as text.

    My question is, how do I create a link based on my XML file? (I would really appreciate any hints that involve only changing flexigrid.js and/or the addition of jQuery code.)


    Thanks.

    You’ll have to construct the link using the uri and name values that you have parsed.

  • #313 / May 16, 2008 10:10am

    frantic

    3 posts

    You’ll have to construct the link using the uri and name values that you have parsed.

    Thanks, Paulo.

    I’m okay with constructing the link, the problem is I’m not really sure where it’s supposed to take place. Any suggestions?

  • #314 / May 16, 2008 10:36am

    paulopmx

    164 posts

    You’ll have to construct the link using the uri and name values that you have parsed.

    Thanks, Paulo.

    I’m okay with constructing the link, the problem is I’m not really sure where it’s supposed to take place. Any suggestions?

    In the addData method, create your own xml parser, and construct a cell row and tbody, before calling the addRowProp and addCellProp

  • #315 / May 16, 2008 11:32am

    ITCANE

    1 posts

    Hello,
    There is a bug using flexigrid with jquery floral theme in firefox (it’s ok under IE7).
    The grid is not displayed correctly.

    Thanks for this awesome plugin

    ITCANE : Web Solutions for Thriving Business

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

ExpressionEngine News!

#eecms, #events, #releases