Welcome Guest, Not a member yet? Register   Sign In
Flexigrid - Lightweight but rich data grid

[eluser]swhitlow[/eluser]
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:
rows: [

{id:'aa505f50-dade-6272-2717-47f2b333320e',cell:['aa505f50-dade-6272-2717-47f2b333320e', '<a href="#"
>Add to Route</a>','2 Big Consolidation Corp 418993','(754
) 301-4377','9 IBM Path','St. Petersburg','CA','37000']},
{id:'d89e5bd7-20d4-8831-65dc-47f2b3d721b2',cell:['d89e5bd7-20d4-8831-65dc-47f2b3d721b2', '<a href="#"
>Add to Route</a>','2 Tall Stores 376377','(236) 854-7906','8923 Chessie
Dr.
','Indianapolis','IN','46217']},
{id:'c0c5e69c-59fa-f341-1aa8-47f2b3a9b06c',cell:['c0c5e69c-59fa-f341-1aa8-47f2b3a9b06c', '<a href="#"
>Add to Route</a>','A.G. Parr PLC 828674','(743) 194-6946','345 Sugar
Blvd.','St. Petersburg','CA','39570']},

Notice the extra carriage return on the line that says "8923 Chessie Dr." then it drops down one line and has the "Indianapolis".

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.

[eluser]paulopmx[/eluser]
[quote author="swhitlow" date="1216388846"]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.[/quote]

Try using json_encode like so:

Code:
$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.

[eluser]Armorfist[/eluser]
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

[eluser]paulopmx[/eluser]
[quote author="Armorfist" date="1216401847"]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[/quote]

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.

[eluser]Unknown[/eluser]
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[i].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...

[eluser]swhitlow[/eluser]
[quote author="paulopmx" date="1216389241"][quote author="swhitlow" date="1216388846"]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.[/quote]

Try using json_encode like so:

Code:
$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.[/quote]

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

Thanks!

[eluser]millercj[/eluser]
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.

[eluser]Unknown[/eluser]
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

[eluser]skaimauve[/eluser]
For those using the YUI comprressor, it will fail on the following line:
Code:
$(this.colCopy).css({position:'absolute',float:'left',display:'none', textAlign: obj.align});

But works fine with this:
Code:
$(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.

[eluser]Kevin Kietel[/eluser]
http://ajaxian.com/archives/lightweight-...for-jquery

Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB