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]
  • #136 / Apr 09, 2008 9:22pm

    ecarsted

    19 posts

    Heya Paulo, Armorfist

    I got the cell click thingy working 😊 Ty Paulo for the code.

    In Armofist’s example online, he shows the add , delete icons on every row.

    Question I have is how did you get the icons to the cell?  Looking at Amorfist’s code
    it looks like he added to the CSS.  But I can’t figure out what he did.

    What I want to do is put a little info icon in the cell, and when they click it, I process
    another query to get detail data.  I guess I need to figure out what the id is for that row too.

    Eric

  • #137 / Apr 09, 2008 10:16pm

    paulopmx

    164 posts

    Heya Paulo, Armorfist

    I got the cell click thingy working 😊 Ty Paulo for the code.

    In Armofist’s example online, he shows the add , delete icons on every row.

    Question I have is how did you get the icons to the cell?  Looking at Amorfist’s code
    it looks like he added to the CSS.  But I can’t figure out what he did.

    What I want to do is put a little info icon in the cell, and when they click it, I process
    another query to get detail data.  I guess I need to figure out what the id is for that row too.

    Eric

    Hi, Eric

    You can use the process API to create a link with a class like so:

    '<a href="http://323" class="add"></a>'

    Then in your style the CSS for al link with the class “add”;

    a.add
        {
        display: block;
         background: url(images/add.png) no-repeat;
         height: 16px;
        width 16px;
        }

    something like that.

  • #138 / Apr 09, 2008 11:20pm

    ecarsted

    19 posts

    Hi, Eric

    You can use the process API to create a link with a class like so:

    '<a href="http://323" class="add"></a>'

    Then in your style the CSS for al link with the class “add”;

    a.add
        {
        display: block;
         background: url(images/add.png) no-repeat;
         height: 16px;
        width 16px;
        }

    something like that.

    Okay, I cheated, I added the same onclick process to every cell in the model, it is the behavior I am looking for (select a row);  Is there any downside to this?

    I know you posted somewhere how to get the row id so I can create a call to get the details for that record, but I cant find it paging back and forth the pages of the forum.  It is starting to get long lol!

    Eric

  • #139 / Apr 10, 2008 11:16am

    dark_lord

    103 posts

    Just to announce that my integration of Flexigrid with CodeIgniter is ready.

    You can see/download it here:

    http://flexigrid.eyeviewdesign.com/

    Any suggestions / bugs / whatever mail me.

    NOTE: I just started to work with Ajax/Jquery so bare with me.

    Hope you like it.

    Ei, armor? I have used your code snippet for the CI integration of Flexigrid, but when I deploy all of your files from what you have specified, still it does not query or show any data at all. What could I possibly missed out? reconfiguring? I have set the database name to the database that i am using. still no luck.. Please help me I am stock.

  • #140 / Apr 10, 2008 11:27am

    Armorfist

    121 posts

    Ei, armor? I have used your code snippet for the CI integration of Flexigrid, but when I deploy all of your files from what you have specified, still it does not query or show any data at all. What could I possibly missed out? reconfiguring? I have set the database name to the database that i am using. still no luck.. Please help me I am stock.

    Could be a path problem, did you deploy the files in a fresh CI instalation?

  • #141 / Apr 10, 2008 11:32am

    dark_lord

    103 posts

    Ei, armor? I have used your code snippet for the CI integration of Flexigrid, but when I deploy all of your files from what you have specified, still it does not query or show any data at all. What could I possibly missed out? reconfiguring? I have set the database name to the database that i am using. still no luck.. Please help me I am stock.

    Could be a path problem, did you deploy the files in a fresh CI instalation?

    Is that the best possible solution? To have a fresh CI installation?

  • #142 / Apr 10, 2008 11:37am

    Armorfist

    121 posts

    Heya Paulo, Armorfist

    I got the cell click thingy working 😊 Ty Paulo for the code.

    In Armofist’s example online, he shows the add , delete icons on every row.

    Question I have is how did you get the icons to the cell?  Looking at Amorfist’s code
    it looks like he added to the CSS.  But I can’t figure out what he did.

    What I want to do is put a little info icon in the cell, and when they click it, I process
    another query to get detail data.  I guess I need to figure out what the id is for that row too.

    Eric

    Hello Eric,

    In my example I simply added the HTML to the data corresponding to that that column.

    Json Code:

    {id:'1',cell:['1','AF','AFGHANISTAN','<span>Afghanistan</span>','AFG','4','<a >\'public/images/add.png\'</a> <a >\'public/images/close.png\'</a> ']}
  • #143 / Apr 10, 2008 11:44am

    Armorfist

    121 posts

    Ei, armor? I have used your code snippet for the CI integration of Flexigrid, but when I deploy all of your files from what you have specified, still it does not query or show any data at all. What could I possibly missed out? reconfiguring? I have set the database name to the database that i am using. still no luck.. Please help me I am stock.

    Could be a path problem, did you deploy the files in a fresh CI instalation?

    Is that the best possible solution? To have a fresh CI installation?

    Its the easy solution not the best 😊. Lets see if we can figure this out:

    - What value do you have in your “base_url” config (in application/config/config.php)
    - Do you have the default CI path structure? (application/controller/)
    - If so, what do you get if you access http://yoururl/ajax

  • #144 / Apr 10, 2008 11:44am

    dark_lord

    103 posts

    Ei, armor? I have used your code snippet for the CI integration of Flexigrid, but when I deploy all of your files from what you have specified, still it does not query or show any data at all. What could I possibly missed out? reconfiguring? I have set the database name to the database that i am using. still no luck.. Please help me I am stock.

    Could be a path problem, did you deploy the files in a fresh CI instalation?

    Still no luck dude, used a fresh installed CI now… still now data is shown.

  • #145 / Apr 10, 2008 11:51am

    dark_lord

    103 posts

    here are the values that I got when I used the

    <a href="http://localhost/jf/index.php/ajax/index">http://localhost/jf/index.php/ajax/index</a>

    {page: 1,total: 239,rows: [{id:'1',cell:['1','AF','AFGHANISTAN','Afghanistan','AFG','4',' ']},{id:'2',cell:['2','AL','ALBANIA','Albania','ALB','8',' ']},{id:'3',cell:['3','DZ','ALGERIA','Algeria','DZA','12',' ']},{id:'4',cell:['4','AS','AMERICAN SAMOA','American Samoa','ASM','16',' ']},{id:'5',cell:['5','AD','ANDORRA','Andorra','AND','20',' ']},{id:'6',cell:['6','AO','ANGOLA','Angola','AGO','24',' ']},{id:'7',cell:['7','AI','ANGUILLA','Anguilla','AIA','660',' ']},{id:'8',cell:['8','AQ','ANTARCTICA','Antarctica','','',' ']},{id:'9',cell:['9','AG','ANTIGUA AND BARBUDA','Antigua and Barbuda','ATG','28',' ']},{id:'10',cell:['10','AR','ARGENTINA','Argentina','ARG','32',' ']}]}

    and then here is my base_url and my index page


    $config[‘base_url’]  = “http://localhost/jf/”;
    $config[‘index_page’] = “index.php”;


    Yup I think I do have the default SYSTEM/APPLICATION/CONTROLLER directory

    What do you think is the problem bro?.. :-(

  • #146 / Apr 10, 2008 11:57am

    Armorfist

    121 posts

    Open the file “system/application/controller/flexigrid.php”, go to line 44 and change:

    $grid_js = build_grid_js('flex1','ajax/',$colModel,$buttons,'id','asc','auto','400',$this->config->item('fg_per_page'));

    to

    $grid_js = build_grid_js('flex1','/jf/index.php/ajax/index',$colModel,$buttons,'id','asc','auto','400',$this->config->item('fg_per_page'));

    I think the first one should work, but lets see if that solves the problem.

    The second function parameter is the URL which the data is retrieved. In this case the “ajax” controller. To see what the other arguments represent open the “system/application/helpers/flexigrid_helper” file and read the function comments.

  • #147 / Apr 10, 2008 12:02pm

    dark_lord

    103 posts

    Open the file “system/application/controller/flexigrid.php”, go to line 44 and change:

    $grid_js = build_grid_js('flex1','ajax/',$colModel,$buttons,'id','asc','auto','400',$this->config->item('fg_per_page'));

    to

    $grid_js = build_grid_js('flex1','/jf/index.php/ajax/index',$colModel,$buttons,'id','asc','auto','400',$this->config->item('fg_per_page'));

    I think the first one should work, but lets see if that solves the problem.

    The second function parameter is the URL which the data is retrieved. In this case the “ajax” controller. To see what the other arguments represent open the “system/application/helpers/flexigrid_helper” file and read the function comments.

    You are a genius dude!!! Nicely solve!!! Cheers! Thanks for the great help! I’ve been figuring this our all night long… :-( Thanks for the great help. Kudos!

  • #148 / Apr 10, 2008 12:13pm

    Armorfist

    121 posts

    Glad I could help! 😊

  • #149 / Apr 10, 2008 12:33pm

    dark_lord

    103 posts

    Glad I could help! 😊

    One more question?

    How come my first column of my record does not display(e.g. ID)? It starts with the second column (e.g. Name)? What could be the problem with my code?

  • #150 / Apr 10, 2008 12:37pm

    Armorfist

    121 posts

    Did you modify the /system/application/controller/ajax.php controller? If so can you post the “foreach” code, the one that runs through all db query records?

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

ExpressionEngine News!

#eecms, #events, #releases