Part of the EllisLab Network
   
48 of 62
48
Flexigrid - Lightweight but rich data grid
Posted: 18 July 2008 03:54 AM   [ Ignore ]   [ # 471 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  165
Joined  04-23-2007
swhitlow - 18 July 2008 03:47 AM

Please note that I have tried the str_replace as well as the json_encode($address) but nothing has worked. Here is what I am getting back through Firebug:

That is where the problem is. If I go into the database and get rid of that one line, It solves the problem. But, I obviously have to code for the user who might input the one line in there. Even if by accident.

Try using json_encode like so:

$rows = array();
    echo
"{";
    echo
"page: $page,\n";
    echo
"total: $total,\n";
    echo
"rows: ";
    foreach (
$db as $row)
        
{
        $rows[]
= array(
        
"id"=>$row['pid']
        
,"cell"=> array(
                
'<a href="'.site_url(" class="edit" title="'.$row['name'].'"></a>'
                ,$row['name']
                ,$row['shortdesc']."
\n Details"
                ,$row['publish']
                )
            );
        }
    echo json_encode($rows);
    echo "
\n";
    echo "
}";

As you can see i’ve purposely added \n on shortdesc, in case my values doesn’t have \n.
Please not that json_encode as well as any ajax app, requires utf-8 encoding.

 Signature 

A Better and more Flexible Paging Solution for CI
Automatic config[base_url]

Profile
 
 
Posted: 18 July 2008 07:24 AM   [ Ignore ]   [ # 472 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  108
Joined  10-18-2007

Hello,
Don’t know if this question was already answered but is it possible to maintain item selection even if you change page? You can see this in the http://www.magentocommerce.com/demo datagrid. You can select only visible records or all records and if you change page it always maintains the selection.

Thanks

 Signature 

Eye View Design - Design Studio
CI FlexiGrid - FlexiGrid on CI Implementation

Profile
 
 
Posted: 18 July 2008 07:30 AM   [ Ignore ]   [ # 473 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  165
Joined  04-23-2007
Armorfist - 18 July 2008 07:24 AM

Hello,
Don’t know if this question was already answered but is it possible to maintain item selection even if you change page? You can see this in the http://www.magentocommerce.com/demo datagrid. You can select only visible records or all records and if you change page it always maintains the selection.

Thanks

Yes its possible to do this. but it requires you to do the bulk of the work, like storing the ids of your row selection either in a cookie or a session array, and then creating a function that will be triggered by onSuccess, to add .trSelected class to previously selected rows.

 Signature 

A Better and more Flexible Paging Solution for CI
Automatic config[base_url]

Profile
 
 
Posted: 18 July 2008 12:44 PM   [ Ignore ]   [ # 474 ]  
Summer Student
Total Posts:  1
Joined  07-18-2008

Hi, I’m triing to use flexigrid, in the easy way… (without json or ajax), just a simple table (with all TRs and TDs tag), and in the flexigrid starter I had assigned buttons to test function, but when I try to retrieve a row reference (id), i get an empty string..
The script that I am using to get the list, is the same script that was posted early in this forum.
  var items = $(’.trSelected’,grid);
  var itemlist =’‘;
  for(i=0;i<items.length;i++){
    itemlist+= items.id.substr(3)+",";
  }
  alert(“Items selected: ”+itemlist);

and the start of flexigrid is:

$(’#users’).flexigrid(
{ colModel:[{display: 'id',name: 'id', width : 100, sortable : true, align: 'left'},
        {display: 'Login',name: 'login', width : 100, sortable : true, align: 'left'},
        {display: 'Nome',name: 'nome', width : 400, sortable : true, align: 'left'} ],
  buttons : [ {name: 'Add', bclass: 'add', onpress : test},
          {name: 'Delete', bclass: 'delete', onpress : test},
          {name: 'Alter', bclass: 'change', onpress : test} ],
  searchitems : [ {display: 'Login', name : 'login', isdefault: true},
            {display: 'Nome', name : 'nome'} ],
  sortname: “id”, sortorder: “asc”, title: ‘Users table’, width: 520, height: 400 } )

well.. what I am doing wrong ? how can I know what row was selected when test function is called ?
sorry about my poor english… is not my native language (I’m brazilian).. and thanks a lot
ah.. and congratulations about your amazing project…

Profile
 
 
Posted: 18 July 2008 11:57 PM   [ Ignore ]   [ # 475 ]  
Summer Student
Total Posts:  24
Joined  05-11-2008
paulopmx - 18 July 2008 03:54 AM
swhitlow - 18 July 2008 03:47 AM

Please note that I have tried the str_replace as well as the json_encode($address) but nothing has worked. Here is what I am getting back through Firebug:

That is where the problem is. If I go into the database and get rid of that one line, It solves the problem. But, I obviously have to code for the user who might input the one line in there. Even if by accident.

Try using json_encode like so:

$rows = array();
    echo
"{";
    echo
"page: $page,\n";
    echo
"total: $total,\n";
    echo
"rows: ";
    foreach (
$db as $row)
        
{
        $rows[]
= array(
        
"id"=>$row['pid']
        
,"cell"=> array(
                
'<a href="'.site_url(" class="edit" title="'.$row['name'].'"></a>'
                ,$row['name']
                ,$row['shortdesc']."
\n Details"
                ,$row['publish']
                )
            );
        }
    echo json_encode($rows);
    echo "
\n";
    echo "
}";

As you can see i’ve purposely added \n on shortdesc, in case my values doesn’t have \n.
Please not that json_encode as well as any ajax app, requires utf-8 encoding.

Just so everyone knows on this board - this worked perfectly. I no longer have the problem of the extra carriage return.

Thanks!

Profile
 
 
Posted: 19 July 2008 11:27 PM   [ Ignore ]   [ # 476 ]  
Summer Student
Total Posts:  11
Joined  04-01-2008

I’ve been using flexigrid for a few different projects and I recently cut/pasted it into one i’m working on now but i’ve got some sort of glitch that i can’t locate. What is happening is the column headers and the data columns are displaying with different widths. Any ideas?

I just re-downloaded the CSS from the site and uploaded it as a double check, so it is the original css file, but that made no difference.

Profile
 
 
Posted: 20 July 2008 09:40 AM   [ Ignore ]   [ # 477 ]  
Summer Student
Total Posts:  2
Joined  05-08-2008

I’m a big fan of this code and trying to implement it with a form as in sample1.html on the site. Could I see the source of post3.php so I can see how the page receives the output of serializearray? Or is there a sample page out there that shows it? Thanks!
Tim Henderson

Profile
 
 
Posted: 20 July 2008 12:04 PM   [ Ignore ]   [ # 478 ]  
Summer Student
Total Posts:  7
Joined  12-16-2006

For those using the YUI comprressor, it will fail on the following line:

$(this.colCopy).css({position:'absolute',float:'left',display:'none', textAlign: obj.align});

But works fine with this:

$(this.colCopy).css({position:'absolute','float':'left',display:'none', textAlign: obj.align});

The problem is that float is a reserved word and the YUI compressor does not know it is used for an array index.

Profile
 
 
Posted: 20 July 2008 04:24 PM   [ Ignore ]   [ # 479 ]  
Summer Student
Total Posts:  22
Joined  04-01-2008

http://ajaxian.com/archives/lightweight-grid-control-for-jquery

:D

 Signature 

jLorem - A Lorem Ipsum Plugin for jQuery

Profile
 
 
Posted: 21 July 2008 02:28 AM   [ Ignore ]   [ # 480 ]  
Summer Student
Total Posts:  5
Joined  07-21-2008

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

Profile
 
 
   
48 of 62
48
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62402 Total Logged-in Users: 33
Total Topics: 76628 Total Anonymous Users: 2
Total Replies: 413875 Total Guests: 430
Total Posts: 490503    
Members ( View Memberlist )