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]
  • #181 / Apr 16, 2008 7:24pm

    paulopmx

    164 posts

    Hi people,

    i have a simple question actually. I want to swap some columns not with drag and drop but with a script function.
    Can i access the method switchCol(x,y) in the flexigrid with javascript ?
    like this one?

    $.fn.switchX = function(p,p1){ //create a new method to access switchCol
            
            alert(p+" p1);
            
            return this.switchCol(p,p1);
    }

    and then with a href i would like to operate the switchX(x,y) method.
    like this:

    
    
    

    thanks a lot!

    Hi Xiomay this will be highly experimental and untested, but you maybe able to access the grid API directly like so:

    var flex = $('#flex1').flexigrid({ parameters set here });
    flex.grid.switchCol(1,2);

    Hope it works out.

  • #182 / Apr 16, 2008 7:25pm

    paulopmx

    164 posts

    Hi Paulo
    When new next realese ??
    David O.

    Hi David,

    Ok i’m putting a nail on my schedule to make it stick 😊.

    I’m planning to make a new release on the 28th of April.

    I’m still addressing some of the concerns and request that I was made aware of. So if anyone has any last minute request, let me know.

    Paulo

    1.Maybe you succeeded in createing a new method for adding a new row ?
    2.Did you succeed in adding an Editable rows features ?
    Pls let me know.

    Hi davigno,

    1. Not yet.
    2. Also not yet, it might not be until 1.5. But i believe someone in this forum was able to use jEditable successfully.

  • #183 / Apr 16, 2008 7:28pm

    paulopmx

    164 posts

    Ok i’m putting a nail on my schedule to make it stick 😊.

    I’m planning to make a new release on the 28th of April.

    I’m still addressing some of the concerns and request that I was made aware of. So if anyone has any last minute request, let me know.

    Paulo

    Would it be possible to create “locked columns”?  i.e. columns on the left that do not scroll as you scroll the rest of the dataset horizontally.

    That would be awesome!  Not that your grid isn’t already awesome.  It is!

    Hi zebrahat,

    I think that would be cool too, but thats a lot of work on my already full schedule. I will think about it and maybe add it to a roadmap. But for reference sake, I believe another grid framework is already doing this.

  • #184 / Apr 16, 2008 7:30pm

    paulopmx

    164 posts

    I’ve just noticed when I run it in ie7 I get an error saying Line: 403 ‘id is null or not an object’.

    Any idea what would cause this?

    Hi synergiq,

    I answered this question here : http://ellislab.com/forums/viewreply/385467/

  • #185 / Apr 16, 2008 7:33pm

    paulopmx

    164 posts

    Hi Paulo
    When new next realese ??
    David O.

    Hi David,

    Ok i’m putting a nail on my schedule to make it stick 😊.

    I’m planning to make a new release on the 28th of April.

    I’m still addressing some of the concerns and request that I was made aware of. So if anyone has any last minute request, let me know.

    Paulo

    So if anyone has any last minute request, let me know.  >>>>
    how about something like this??
    http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
    (I’ve tried to get it running, but no success…..  😖 )

    Hi Kevin,

    That’s cool Kevin, I will test this if its feasible in my schedule.

  • #186 / Apr 17, 2008 4:40am

    Balaji ASP

    2 posts

    Nice, very nice. Thx my friend…!!

    i used this query for my applications it’s works good…

    I’ve just noticed when I run it in ie7

    server 2003:
    I get an error saying Line: 402 ‘id is null or not an object’.

    xp:
    I get an error saying Line: 403 ‘id is null or not an object’.

    here is the link
    http://synergiq.co.uk/test/flexigrid/

    plz help me my friend… ASAP…

    Hi Balaji,

    Here is your problem at the last part of asp file that generates the JSON FILE

    {id:'245', cell:['245', 'collin','sharples','green','200','sleepy','70','female','76 water terrace','15 rue des begognas','76 water terrace','45 rue de la liberte','london bridge (right under it)','Australia','Bourgogne','1']},
    ]}

    as you can see there is a comma after “‘Bourgogne’,‘1’]}” what happens is that IE is expecting another array object, but the truth is there isn’t anymore. Firefox tries to fix this automatically, but IE requires you to fix it and follow proper array format.

    Thx Thx Thx my friend… for your valuable replay!! 😊

    now it’s working fine… in IE7,Mozilla and other browsers

    here is the code i used with your suggestion

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include File="INC_FILES/ADOVBS.INC"-->
    <%
    set cnn = server.createobject("ADODB.Connection")
    cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server;.MapPath("test")&".mdb;"
    
    Set RecordsetXML = Server.CreateObject ("ADODB.Recordset")
        RecordsetXML.CursorType = adOpenDynamic
        RecordsetXML.CursorLocation = adUseClient
    Set RecordsetXML2 = Server.CreateObject ("ADODB.Recordset")
        RecordsetXML2.CursorType = adOpenDynamic
        RecordsetXML2.CursorLocation = adUseClient    
    'Page Numbers
    Dim page
    page = Request.Form("page")
    if page = "" then 
    page = 1
    End if
    
    Dim rp
    rp = Request.Form("rp")
    if rp = "" then
    rp = 15
    End if
    
    Dim start
    start = ((page-1) * rp)
    limit = " TOP "&page;*rp 
    
    
    
    'Search Bits
    Dim searchterm
    Dim sortname
    if Request.Form("sortname") = "" then
    sortname = "id" 
    Else
    sortname = Request.Form("sortname")
    End If
    
    Dim sortorder
    if Request.Form("sortorder") = "" then
    sortorder = "desc" 
    Else
    sortorder = Request.Form("sortorder")
    End If
    
    Dim sort 
    
    sort = " ORDER By "&sortname;&" "&sortorder;if Request.form("query") <> "" then
    searchterm = Request.form("query")
    searchcols = request.form("qtype")
    if searchcols = "id" then
        if isnumeric(searchterm) then
        fullsearch = "WHERE "&searchcols;&" = "&searchterm;else
        fullsearch = ""
        end if
    Else
        fullsearch = "WHERE "&searchcols;&" LIKE '%"&searchterm;&"%'"
    End if
    End if
    
    'Main Query
    Dim RecordsetXML
    Dim RecordsetXML_cmd
    Dim RecordsetXML_numRows
    
    RecordsetXML_cmd = "SELECT "& limit &" * FROM person "&fullsearch;&""&sort;RecordsetXML.open RecordsetXML_cmd,cnn,3,3
    RecordsetXML_numRows = 0
    
    'Count Recordset
    Dim RecordsetXML2
    Dim RecordsetXML2_cmd
    Dim RecordsetXML2_numRows
    
    RecordsetXML2_cmd= "SELECT count(*) as countR FROM person"
    
    RecordsetXML2.open RecordsetXML2_cmd,cnn,3,3
    RecordsetXML2_numRows = 0
    
    Dim total
    Dim countRec
    total = RecordsetXML2.Fields.Item("countR").Value
    
    RecordsetXML2.Close()
    Set RecordsetXML2 = Nothing
    
    
    %>
    {
    page: <%=page%>,
    total: <%=cstr(total)%>,
    rows: [
    <%
    RecordsetXML.Move start
    
    for i=start to RecordsetXML.recordcount-1
    if i <> RecordsetXML.recordcount-1 then
    %>
    {id:'<%=(RecordsetXML.Fields.Item("id").Value)%>', cell:['<%=(RecordsetXML.Fields.Item("id").Value)%>', '<%=(RecordsetXML.Fields.Item("firstname").Value)%>','<%=(RecordsetXML.Fields.Item("lastname").Value)%>','<%=(RecordsetXML.Fields.Item("color").Value)%>','<%=(RecordsetXML.Fields.Item("height").Value)%>','<%=(RecordsetXML.Fields.Item("middlename").Value)%>','<%=(RecordsetXML.Fields.Item("age").Value)%>','<%=(RecordsetXML.Fields.Item("sex").Value)%>','<%=(RecordsetXML.Fields.Item("address1").Value)%>','<%=(RecordsetXML.Fields.Item("address2").Value)%>','<%=(RecordsetXML.Fields.Item("address3").Value)%>','<%=(RecordsetXML.Fields.Item("address4").Value)%>','<%=(RecordsetXML.Fields.Item("address5").Value)%>','<%=(RecordsetXML.Fields.Item("country").Value)%>','<%=(RecordsetXML.Fields.Item("region").Value)%>','<%=(RecordsetXML.Fields.Item("is_dead").Value)%>']},
    <%else%>
    {id:'<%=(RecordsetXML.Fields.Item("id").Value)%>', cell:['<%=(RecordsetXML.Fields.Item("id").Value)%>', '<%=(RecordsetXML.Fields.Item("firstname").Value)%>','<%=(RecordsetXML.Fields.Item("lastname").Value)%>','<%=(RecordsetXML.Fields.Item("color").Value)%>','<%=(RecordsetXML.Fields.Item("height").Value)%>','<%=(RecordsetXML.Fields.Item("middlename").Value)%>','<%=(RecordsetXML.Fields.Item("age").Value)%>','<%=(RecordsetXML.Fields.Item("sex").Value)%>','<%=(RecordsetXML.Fields.Item("address1").Value)%>','<%=(RecordsetXML.Fields.Item("address2").Value)%>','<%=(RecordsetXML.Fields.Item("address3").Value)%>','<%=(RecordsetXML.Fields.Item("address4").Value)%>','<%=(RecordsetXML.Fields.Item("address5").Value)%>','<%=(RecordsetXML.Fields.Item("country").Value)%>','<%=(RecordsetXML.Fields.Item("region").Value)%>','<%=(RecordsetXML.Fields.Item("is_dead").Value)%>']}
    <%
    end if
    RecordsetXML.movenext
    next
    %>
    ]}
    
    <%
    RecordsetXML.Close()
    Set RecordsetXML = Nothing
    %>


    Thx once again my friend…
    😊

  • #187 / Apr 17, 2008 6:08am

    Xiomay

    4 posts

    thanks for the quick reply but it unfortunately doesnt work.

    what kind of parameters i should so set within this brackets?

    var flex = $('#table-1').flexigrid({set parameters here});

    shall put these codes in the flexigrid.js? or in my own js-script file?

    and this code brings error:

    flex.grid.switchCol(7,5);

    this method

    switchCol: function(cdrag,cdrop) { //switch columns
    ...
    }

    is to swap the columns table, am i right?

  • #188 / Apr 17, 2008 10:49am

    Xiomay

    4 posts

    thanks for the quick reply but it unfortunately doesnt work.

    what kind of parameters i should so set within this brackets?

    var flex = $('#table-1').flexigrid({set parameters here});

    shall put these codes in the flexigrid.js? or in my own js-script file?

    and this code brings error:

    flex.grid.switchCol(7,5);

    this method

    switchCol: function(cdrag,cdrop) { //switch columns
    ...
    }

    is to swap the columns table, am i right?

    Now i did it .. but i can only mov the <tbody>, the <thead> still remains at the same position :(


    its like this:

    function swapCol(id){
        var flex = $('#'+id).flexigrid({});
        flex.moveColumn(1,9);
    }
    $.fn.moveColumn = function(c1,c2) { // function to test
         return this.each( function() {
         if (this.grid) this.grid.switchCol(c1,c2);
         });
    }; //end test
  • #189 / Apr 17, 2008 12:40pm

    dah

    4 posts

    Thanks! Flexigrid is great. I have been working with it for a while now. I added buttons across the top for each letter of the alphabet to allow users to quickly jump to that record set. Works well except for one issue I am working with…

    it holds the page number when you click a new letter. So, if you were on page 3 of the records that start with “S” and then click the “A” record set, it starts on page 3 of the “A” set. Get it? I wish I could just show you but currently all the code is behind the firewall. Soon tho.

    Any ideas on how to reset that page when I click a new letter sorting option?

    Thanks again for the great code!

    Hi dah,

    Yes you just set the new page in the parameters before reloading flexigrid like so:

    $('#flex1').flexOptions({newp:1});

    Have fun.

    function sortAlpha(com)
                            {
                            $('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value: com}]});
                            $("#flex1").flexReload();
                            }

    that seemed to do it!

  • #190 / Apr 17, 2008 8:37pm

    paulopmx

    164 posts

    thanks for the quick reply but it unfortunately doesnt work.

    what kind of parameters i should so set within this brackets?

    var flex = $('#table-1').flexigrid({set parameters here});

    shall put these codes in the flexigrid.js? or in my own js-script file?

    and this code brings error:

    flex.grid.switchCol(7,5);

    this method

    switchCol: function(cdrag,cdrop) { //switch columns
    ...
    }

    is to swap the columns table, am i right?

    Now i did it .. but i can only mov the <tbody>, the <thead> still remains at the same position :(


    its like this:

    function swapCol(id){
        var flex = $('#'+id).flexigrid({});
        flex.moveColumn(1,9);
    }
    $.fn.moveColumn = function(c1,c2) { // function to test
         return this.each( function() {
         if (this.grid) this.grid.switchCol(c1,c2);
         });
    }; //end test

    Great Effort Xiomay! Try adding this:

    $.fn.moveColumn = function(c1,c2) { // function to test
         return this.each( function() {
    
                                if (c1>c2)
                                    $('th:eq('+c2+')',this.grid.hDiv).before($('th:eq('+c1+')',this.grid.hDiv));
                                else
                                    $('th:eq('+c2+')',this.grid.hDiv).after($('th:eq('+c1+')',this.grid.hDiv));
                                
    
         if (this.grid) this.grid.switchCol(c1,c2);
         });
    };
  • #191 / Apr 18, 2008 4:53am

    Xiomay

    4 posts

    thanks for the quick reply but it unfortunately doesnt work.

    what kind of parameters i should so set within this brackets?

    var flex = $('#table-1').flexigrid({set parameters here});

    shall put these codes in the flexigrid.js? or in my own js-script file?

    and this code brings error:

    flex.grid.switchCol(7,5);

    this method

    switchCol: function(cdrag,cdrop) { //switch columns
    ...
    }

    is to swap the columns table, am i right?

    Now i did it .. but i can only mov the <tbody>, the <thead> still remains at the same position :(


    its like this:

    function swapCol(id){
        var flex = $('#'+id).flexigrid({});
        flex.moveColumn(1,9);
    }
    $.fn.moveColumn = function(c1,c2) { // function to test
         return this.each( function() {
         if (this.grid) this.grid.switchCol(c1,c2);
         });
    }; //end test

    Great Effort Xiomay! Try adding this:

    $.fn.moveColumn = function(c1,c2) { // function to test
         return this.each( function() {
    
                                if (c1>c2)
                                    $('th:eq('+c2+')',this.grid.hDiv).before($('th:eq('+c1+')',this.grid.hDiv));
                                else
                                    $('th:eq('+c2+')',this.grid.hDiv).after($('th:eq('+c1+')',this.grid.hDiv));
                                
    
         if (this.grid) this.grid.switchCol(c1,c2);
         });
    };

    AWESOME it works!
    thanks a lot man.

  • #192 / Apr 18, 2008 5:04pm

    dah

    4 posts

    OK, i know I am probably going to take heat for this, but here we go. For reasons I’d rather not get into,  I am using both Mootools and jQuery in the development of an app.

    check it out:

    http://impact.accountbuilder.com/AB2/flexigrid/index.html?moo=y

    there is a link at the bottom to turn off the Mootools and see the Flexigrid work without the “undefined” issues.
    Anyone have a work around for this? Is it as simple as changing some $eventw or $ refs in flexigrid.js? Any ideas?

    (oh and i just found the whole thing, mootools or not doesn’t load in PC Firefox. The Flexgrid i have behind the firewall is working the same as the IE, I don’t know why the link above on PC Ff doesn’t work.)

    Thanks everyone!

    (if you intend to just suggest I only use one framework, I know, I get it. )

  • #193 / Apr 18, 2008 5:31pm

    cgriffin

    1 posts

    I am moving over from ExtJS. I really like what you have done. I like the way the search comes up and the way you can select sorting, etc. Great work! I have one problem though. I have a grid set up and working on FF 2 Mac but I get an error in IE7 XP. The error is occurring on line 664 of the 1.0b2 source:

    if (this[removed]==’‘) this[removed] = ‘ ’;

    I’ve checked my JSON data and it is valid with no extra commas. I somewhat confused because according to Visual Web Developer 2008 ‘this’ is a valid TD element. Any ideas?

    Thanks.

  • #194 / Apr 18, 2008 8:48pm

    paulopmx

    164 posts

    I am moving over from ExtJS. I really like what you have done. I like the way the search comes up and the way you can select sorting, etc. Great work! I have one problem though. I have a grid set up and working on FF 2 Mac but I get an error in IE7 XP. The error is occurring on line 664 of the 1.0b2 source:

    if (this[removed]==’‘) this[removed] = ‘ ’;

    I’ve checked my JSON data and it is valid with no extra commas. I somewhat confused because according to Visual Web Developer 2008 ‘this’ is a valid TD element. Any ideas?

    Thanks.

    Hi cgriffin,

    Its easier for me to detect the error if I can see the app running, can you give me a link.

    Paulo

  • #195 / Apr 18, 2008 8:59pm

    paulopmx

    164 posts

    OK, i know I am probably going to take heat for this, but here we go. For reasons I’d rather not get into,  I am using both Mootools and jQuery in the development of an app.

    check it out:

    http://impact.accountbuilder.com/AB2/flexigrid/index.html?moo=y

    there is a link at the bottom to turn off the Mootools and see the Flexigrid work without the “undefined” issues.
    Anyone have a work around for this? Is it as simple as changing some $eventw or $ refs in flexigrid.js? Any ideas?

    (oh and i just found the whole thing, mootools or not doesn’t load in PC Firefox. The Flexgrid i have behind the firewall is working the same as the IE, I don’t know why the link above on PC Ff doesn’t work.)

    Thanks everyone!

    (if you intend to just suggest I only use one framework, I know, I get it. )

    jah,

    jquery seems to be not loading properly with mootools or otherwise. It could be a comment thing, can you try removing the comments?

    Paulo

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

ExpressionEngine News!

#eecms, #events, #releases