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

[eluser]paulopmx[/eluser]
[quote author="newbie_CI" date="1210665136"]Hi Forum,

I'm new to the whole CI and has downloaded the flexigrid. It's is awesome. I been playing around with it and wondering how do I get my text wrap within the cell. I have a long text in some of my database fields and would like the text to wrap within the cell. Any help would be greatly appreciated.

Thanks[/quote]

just add this to the parameters of your flexigrid
Code:
nowrap: false

[eluser]paulopmx[/eluser]
[quote author="frantic" date="1210631089"]First off, I've started using Flexigrid a while ago, and am very impressed. Great job Paulo!

I am currently trying to customize it in a unique way, and was wondering if anyone could give me some advice.

So, this is the situation... I am calling a dynamic XML file via AJAX to populate the grid. The XML looks something like the sample below. The output can sometimes include links. However, right now all I get is the values of the 'uri' and 'name' nodes as text.

My question is, how do I create a link based on my XML file? (I would really appreciate any hints that involve only changing flexigrid.js and/or the addition of jQuery code.)


Thanks.

You'll have to construct the link using the uri and name values that you have parsed.

[eluser]frantic[/eluser]
[quote author="paulopmx" date="1210919664"]You'll have to construct the link using the uri and name values that you have parsed.[/quote]

Thanks, Paulo.

I'm okay with constructing the link, the problem is I'm not really sure where it's supposed to take place. Any suggestions?

[eluser]paulopmx[/eluser]
[quote author="frantic" date="1210961414"][quote author="paulopmx" date="1210919664"]You'll have to construct the link using the uri and name values that you have parsed.[/quote]

Thanks, Paulo.

I'm okay with constructing the link, the problem is I'm not really sure where it's supposed to take place. Any suggestions?[/quote]

In the addData method, create your own xml parser, and construct a cell row and tbody, before calling the addRowProp and addCellProp

[eluser]Unknown[/eluser]
Hello,
There is a bug using flexigrid with jquery floral theme in firefox (it's ok under IE7).
The grid is not displayed correctly.

Thanks for this awesome plugin

ITCANE : Web Solutions for Thriving Business

[eluser]frantic[/eluser]
[quote author="paulopmx" date="1210963000"]In the addData method, create your own xml parser, and construct a cell row and tbody, before calling the addRowProp and addCellProp[/quote]

Thanks, I'll give it a try.

[eluser]Unknown[/eluser]
I am an embedded software engineer with very little web dev. experience. I want to use the Flexigrid to display some timing results from a piece of hardware that I am making. You can see the interface here: http://www.motocon.net

I have 3 questions:

1. how do I set the font type, size and color of the column data independently of all of the other text? ( the floating point numbers at the above URL )

2. again looking at the above URL, is there a way to put some sort of separator in the toolbar between the buttons, or right justify the initialize button from the others?

3. how can I center the "Timer Test" title?

Many Thanks,

John

[eluser]swhitlow[/eluser]
This control is just incredible! It has really helped me out with some projects.

I was wondering - I have recently included it in a SugarCRM instance within a form. It is now displaying the outline of the grid and some of the controls. However, the middle part where the data would be displayed is missing and just plain white. As well as the some of the controls are messed up on the bottom. Now, here is the main problem - no errors or anything is showing up in Firebug. So, I really do not have a way of debugging the problem. Is there a way to debug what is going on so I can track down the problem?

I have attached a screenshot to this post. Here is the js code:

Code:
var $j = jQuery.noConflict();
    

    $j(document).ready(function(){
        $j("#flex1").flexigrid
                (
                {
                url: 'pharma_SamplesListGrid.php?current_id={{$current_id}}',
                dataType: 'json',
                colModel : [
                    {display: 'ID', name : 'id', width : 40, sortable : false, align: 'center', hide: true},
                    {display: 'Action', name: 'action', width : 80, sortable : false, align: 'left'},
                    {display: 'Name', name : 'name', width : 180, sortable : true, align: 'left'},
                    {display: 'Status', name : 'status', width : 80, sortable : true, align: 'left'},
                    {display: 'Lot #', name : 'lot_number', width : 120, sortable : true, align: 'left'},
                    {display: 'Quantity', name : 'quantity', width : 90, sortable : true, align: 'left'},
                    {display: 'UM', name : 'um', width : 25, sortable : true, align: 'left'}
                    ],
                searchitems : [
                    {display: 'Name', name : 'name', isdefault: true},
                    {display: 'Status', name : 'status'},
                    {display: 'Lot #', name : 'lot_number'}
                    ],
                sortname: "name",
                sortorder: "asc",
                usepager: true,
                title: 'Add Samples to Transfer',
                useRp: true,
                rp: 10,
                showTableToggleBtn: true,
                width: '100%',
                height: 125
                }
                );  



    });

And here is the PHP code that is generating the data (well the main part that is the heart of it anyway):

Code:
while ($row = mysql_fetch_array($result)) {
if ($rc) $json .= ",";

    $json .= "\n{";
    $json .= "id:'".$row['id']."',";
    $json .= "cell:['".$row['id']."'";
    $json .= ", '&lt;a href=\"#\" onclick=\"addToSamplesList(\'" . $row['id'] . "\', \'" . addslashes($row['name']) . "\', \'" . addslashes($row['status']) . "\', \'" . addslashes($row['lot_number']) . "\', \'" . addslashes($row['quantity']) . "\', \'" . addslashes($row['um']) . "\', \'samples_list_table\');\"&gt;Add to Transfer</a>'";
    $json .= ",'" . addslashes($row['name']) . "'";
    $json .= ",'" . addslashes($row['status']) . "'";
    $json .= ",'" . addslashes($row['lot_number']) . "'";
    $json .= ",'" . addslashes($row['quantity']) . "'";
    $json .= ",'" . addslashes($row['um']) . "'";
    $json .= "]";
    $json .= "}";
    $rc = true;
}
$json .= "]\n";
$json .= "}";
echo $json;

Thanks for your help! Smile

[eluser]ozskry[/eluser]
Hi there,

I'm currently trying to implement Flexigrid in a website but it doesn't work and don't know why.

Here is the PHP code generating the JSON file:

Code:
&lt;?php
error_reporting(E_ALL);
function runSQL($rsql) {
    $hostname = 'xxx';
    $username = 'xxx';
    $password = 'xxx';
    $dbname   = 'ms_catalog';
    $connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
    $db = mysql_select_db($dbname);
    $result = mysql_query($rsql) or die ('test');
    return $result;
    mysql_close($connect);
}

function countRec($fname,$tname) {
$sql = "SELECT count($fname) FROM $tname ";
$result = runSQL($sql);
while ($row = mysql_fetch_array($result)) {
return $row[0];
}
}

if (isset($_POST['page'])) {
    $page = $_POST['page'];
}
if (isset($_POST['rp'])) {
    $rp = $_POST['rp'];
}
if (isset($_POST['sortname'])) {
    $sortname = $_POST['sortname'];
}
if (isset($_POST['sortorder'])) {
    $sortorder = $_POST['sortorder'];
}

if (!isset($sortname)) {
    $sortname = 'name';
}
if (!isset($sortorder)) {
    $sortorder = 'desc';
}

$sort = "ORDER BY $sortname $sortorder";

if (!isset($page)) {
    $page = 1;
}
if (!isset($rp)) {
    $rp = 10;
}

$start = (($page-1) * $rp);

$limit = "LIMIT $start, $rp";

$sql = "SELECT * FROM ms_smurfs $sort $limit";
$result = runSQL($sql);

$total = countRec('name','ms_smurfs');

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: $page,\n";
$json .= "total: $total,\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
if ($rc) $json .= ",";
$json .= "\n{";
$json .= "id:'".$row['id_ms_smurfs']."',";
$json .= "cell:['".$row['id_ms_smurfs']."'";
$json .= ",'".addslashes($row['name'])."'";
$json .= ",'".addslashes($row['category'])."'";
$json .= ",'".addslashes($row['vectorization'])."'";
$json .= ",'".addslashes($row['availability'])."'";
$json .= ",'".addslashes($row['random_id'])."']";
$json .= "}";
$rc = true;
}
$json .= "]\n";
$json .= "}";
echo $json;
?&gt;

Here the JSON file generated:

Code:
{
page: 1,
total: 623,
rows: [
{id:'651',cell:['651','settings_work_006','settings','Vectorized','Available','9Pk10w8D1emzPIL']},
{id:'650',cell:['650','settings_work_005','settings','Vectorized','Available','ZGqfv50wRsiw44S']},
{id:'649',cell:['649','settings_work_004','settings','Vectorized','Available','fHNuGg2JO4rSOu']},
{id:'648',cell:['648','settings_work_003','settings','Vectorized','Available','xbRoHaKRV7HavVO']},
{id:'647',cell:['647','settings_work_002','settings','Vectorized','Available','ipZp9tUDZXTS9mr']},
{id:'646',cell:['646','settings_work_001','settings','Vectorized','Available','CPtUYaMXMm8IGf4']},
{id:'645',cell:['645','settings_winter_013','settings','Vectorized','Available','4uLHgYj4FiVXSau']},
{id:'644',cell:['644','settings_winter_012','settings','Vectorized','Available','02nBkstgJ621bd']},
{id:'466',cell:['466','settings_winter_011','settings','Vectorized','Available','IvY02RkyX2pDbdB']},
{id:'319',cell:['319','settings_winter_010','settings','Vectorized','Available','t66coq3CvMS5VZD']}]
}

Here is the script:

Code:
$("#flex1").flexigrid
    (
    {
    url: 'post2.php',
    dataType: 'json',
    colModel: [
        {display: 'ID', name : 'id_ms_smurfs', width : 40, sortable : true, align: 'center'},
        {display: 'Name', name : 'name', width : 40, sortable : true, align: 'center'},
        {display: 'Category', name : 'category', width : 180, sortable : true, align: 'left'},
        {display: 'Vectorization', name : 'vectorization', width : 120, sortable : true, align: 'left'},
        {display: 'Availability', name : 'availability', width : 130, sortable : true, align: 'left'},
        {display: 'Random ID', name : 'random_id', width : 80, sortable : true, align: 'right'}
        ],
    searchitems: [
        {display: 'ID', name : 'id'},
        {display: 'Name', name : 'name', isdefault: true}
        ],
    sortname: 'id',
    sortorder: 'asc',
    usepager: true,
    title: 'Smurfs',
    useRp: true,
    rp: 10,
    showTableToggleBtn: true,
    width: 700,
    height: 255
    }
    );
});

And here is the result:

Flexigrid

The processing never ends and nothing displays in the table. What's wrong?

Thanks in advance.

Best regards,
Cary

[eluser]Unknown[/eluser]
Hi - is it possible to fix the cols, so that they are not resizable?

Greets, EvilBMP




Theme © iAndrew 2016 - Forum software by © MyBB