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]
  • #271 / May 05, 2008 1:56pm

    paky

    13 posts

    Hi can I insert a img tag in flexigrid ? I’ve a folder with jpeg files ...

    thanks 😊

    P.S.
    I found a solution 😛 (here the code)

    while ($row = mysql_fetch_array($result)) {
    $user_photo=(file_exists(PHOTO_FILE_PATH.$row['ute_id'].'_first.jpg'))?PHOTO_FILE_PATH.$row['ute_id'].'_first.jpg':PHOTO_FILE_PATH.'default.jpg';
    if ($rc) $json .= ",";
    $json .= "\n{";
    $json .= "id:'".$row['ute_id']."',";
    $json .= "cell:[";
    //$json .= "'".$row['ute_id']."'";
    $json .= "'".addslashes(''.$user_photo.')."'";  //<---------- line solution ...
    $json .= ",'".$row['ute_cognome'].' '.$row['ute_nome']."'";
    $json .= ",'".addslashes($row['bar_nome'])."'";
    $json .= ",'".addslashes($row['bar_cabine'])."'";
  • #272 / May 06, 2008 8:23am

    somemilk

    7 posts

    Hi, thanks for the great plugin.
    Sorry for my ignorance, but i can’t figure how to reload the grid. All examples i saw here so far are implementing edit/delete rows in just alerting selected rows way, but if i really delete some rows, i must reload the grid after successful ajax call, how do i do that? how do i access the properties of the created grid?

  • #273 / May 06, 2008 8:27am

    Kevin Kietel

    22 posts

    Hi, thanks for the great plugin.
    Sorry for my ignorance, but i can’t figure how to reload the grid. All examples i saw here so far are implementing edit/delete rows in just alerting selected rows way, but if i really delete some rows, i must reload the grid after successful ajax call, how do i do that? how do i access the properties of the created grid?

    Hi,

    try this:  $(”#flex1”).flexReload();

    function test(com,grid)
    {
        if (com=='Delete')
            {
               if($('.trSelected',grid).length>0){
               if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
                var items = $('.trSelected',grid);
                var itemlist ='';
                for(i=0;i<items.length;i++){
                    itemlist+= items<i>.id.substr(3)+",";
                }
                $.ajax({
                   type: "POST",
                   dataType: "json",
                   url: "delete.php",
                   data: "items="+itemlist,
                   success: function(data){
                       alert〈"Query: "+data.query+" - Total affected rows: "+data.total〉;
                   $("#flex1").flexReload();
                   }
                 });
                }
                } else {
                    return false;
                } 
            }
        else if (com=='Add')
            {
                alert〈'Add New Item Action'〉;
               
            }            
    }

    You can see it working on my example at:

    http://www.sanderkorvemaker.nl/test/flexigrid/

    Let me know if it’s working!

    Sander

  • #274 / May 06, 2008 8:41am

    somemilk

    7 posts

    Hi.

    try this:  $(”#flex1”).flexReload();

    You can see it working on my example at:

    http://www.sanderkorvemaker.nl/test/flexigrid/

    Let me know if it’s working!

    Sander

    Thanks.
    Unfortunately it doesn’t work for me for IE6, first i tried this on FF and it worked just fine, and then tested on IE - it just outputs the first confirm “Delete N items?” and then nothing, no JS errors, no alerts, no reload. The flexReload() in my code works fine on FF but on IE6 it tries to reload but reloaded grid is empty :(

  • #275 / May 06, 2008 8:54am

    Kevin Kietel

    22 posts

    Hi.

    try this:  $(”#flex1”).flexReload();

    You can see it working on my example at:

    http://www.sanderkorvemaker.nl/test/flexigrid/

    Let me know if it’s working!

    Sander

    Thanks.
    Unfortunately it doesn’t work for me for IE6, first i tried this on FF and it worked just fine, and then tested on IE - it just outputs the first confirm “Delete N items?” and then nothing, no JS errors, no alerts, no reload. The flexReload() in my code works fine on FF but on IE6 it tries to reload but reloaded grid is empty :(

    Hmmm… that’s strange, when I try my own example in IE6, it works just fine. When I select one or more items, and press Delete, I get a confrim “Delete 2 items” and then the delete function is triggered to delete those items. After that the flexigrid is reloaded.

    Can you send me the URL to your version? I might take a look for you!

    Thanks,
    Kevin

  • #276 / May 06, 2008 9:15am

    somemilk

    7 posts

    Hmmm… that’s strange, when I try my own example in IE6, it works just fine. When I select one or more items, and press Delete, I get a confrim “Delete 2 items” and then the delete function is triggered to delete those items. After that the flexigrid is reloaded.

    Can you send me the URL to your version? I might take a look for you!

    It’s somewhat deep in the devel site but I’ll make a copy in my sandbox, please wait for some time.

  • #277 / May 06, 2008 9:16am

    Kevin Kietel

    22 posts

    Hmmm… that’s strange, when I try my own example in IE6, it works just fine. When I select one or more items, and press Delete, I get a confrim “Delete 2 items” and then the delete function is triggered to delete those items. After that the flexigrid is reloaded.

    Can you send me the URL to your version? I might take a look for you!

    It’s somewhat deep in the devel site but I’ll make a copy in my sandbox, please wait for some time.

    If you want, you can PM me the URL 😊

  • #278 / May 06, 2008 10:00am

    somemilk

    7 posts

    If you want, you can PM me the URL 😊

    It’s not that simple in my case 😊
    Anyway, i’ve made a test script here http://somemilk.org/flexitest/
    But it’s very strange, it works fine in both FF and IE while your example still doesn’t work 😊 So i guess it’s my fault somewhere in my code and i’ll look for it, but your code doesn’t work for me either. I’ll tell you the exact conditions which may help to reproduce this.

    1. opening your URL http://www.sanderkorvemaker.nl/test/flexigrid/ with MSIE 6.0
    2. clicking on afghanistan, albania, algeria
    3. clicking on “delete”. “Delete 3 items?” confirm box appears
    4. clicking OK, nothing happens

    This is a stable behavior because our tester noticed that independently from me, he has MSIE6 too.

  • #279 / May 06, 2008 10:06am

    Kevin Kietel

    22 posts

    If you want, you can PM me the URL 😊

    It’s not that simple in my case 😊
    Anyway, i’ve made a test script here http://somemilk.org/flexitest/
    But it’s very strange, it works fine in both FF and IE while your example still doesn’t work 😊 So i guess it’s my fault somewhere in my code and i’ll look for it, but your code doesn’t work for me either. I’ll tell you the exact conditions which may help to reproduce this.

    1. opening your URL http://www.sanderkorvemaker.nl/test/flexigrid/ with MSIE 6.0
    2. clicking on afghanistan, albania, algeria
    3. clicking on “delete”. “Delete 3 items?” confirm box appears
    4. clicking OK, nothing happens

    This is a stable behavior because our tester noticed that independently from me, he has MSIE6 too.

    In my example I’ve added the functionality to delete selected items. The actual delete action is disabled in the php page, to prevent data loss 😉

  • #280 / May 06, 2008 10:09am

    somemilk

    7 posts

    In my example I’ve added the functionality to delete selected items. The actual delete action is disabled in the php page, to prevent data loss 😉

    Well I mean that in FF i got the message with SQL and grid reload. In MSIE I got no message and no reload. In both browsers there are no data loss of course but in the first one grid is reloaded and in second it isn’t 😊

  • #281 / May 06, 2008 10:35am

    Kevin Kietel

    22 posts

    In my example I’ve added the functionality to delete selected items. The actual delete action is disabled in the php page, to prevent data loss 😉

    Well I mean that in FF i got the message with SQL and grid reload. In MSIE I got no message and no reload. In both browsers there are no data loss of course but in the first one grid is reloaded and in second it isn’t 😊


    Found the problem:

    IE is very strict with the returned JSON data…

    this is what my page returned:

    {
    query: 'DELETE FROM `country` WHERE `id` IN (1,5,4)',
    total: 3,
    }

    I removed the trailing comma (,) and voila! it works!  😛

    Thanks for testing 😊

  • #282 / May 06, 2008 10:39am

    somemilk

    7 posts

    I removed the trailing comma (,) and voila! it works!  😛

    Thanks for testing 😊

    Thank you 😊 Yes, it works now for me too.

  • #283 / May 06, 2008 12:48pm

    lordarthas

    1 posts

    Hi folks!

    First of all, Flexigrid is awesome.

    Here’s a patch to allow the selection of one-and-only-one record at a time.

    1) Find line 52 of flexigrid.js, which reads:

    onSubmit: false // using a custom populate function

    and change it to (adding the comma and a new line):

    onSubmit: false, // using a custom populate function
    multiselect: false  // allow selection of multiple elements

    2) Find line 709 which reads:

    var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;

    and, after it, add:

    if ( p.multiselect == false ) {
      $(t).find("tr.trSelected:not(#" + this.id + ")").removeClass('trSelected'); 
    }

    That’s it. You can still create multi-select flexigrids, by supplying the:

    multiselect: true

    parameter when creating one.

    On a side note, I think the ideal solution for Flexigrid would be to always have the mouse click unselect all other items, while giving the option to make multiple selection using control and shift keys (if multiselect is enabled, otherwise don’t give that option at all). This is probably the behaviour most GUI users expect.

    Hope this is useful for somebody.

    Michele.

  • #284 / May 06, 2008 10:15pm

    adwin

    77 posts

    Hi I just learn about Flexigrid ...

    I have question,

    I have table that can be updated. for example I have customer orders, I can add new items into the table.
    I want to update the table using ajax. But I know how to add ($(‘tbody’).append(data)) but how to sort manually (for exmaple sort by column no 1).

  • #285 / May 07, 2008 2:29am

    adwin

    77 posts

    I use Flexigrid ... and I use this example http://flexigrid.eyeviewdesign.com/

    I can display the data, doing pagination ... but I cannot search.
    I click the magnifier to search, then I enter the keyword, after that I press return.

    It doesn’t submit anything and I check using firebug ... it doesnt call the ajax function.

    anyone has solutions for this ?
    Thanks !

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

ExpressionEngine News!

#eecms, #events, #releases