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

[eluser]millercj[/eluser]
It seems to be correct but it is currently at http://stjohnsuccjonestown.org/beta/test/post.php
#42

[eluser]paulopmx[/eluser]
[quote author="millercj" date="1207206356"]It seems to be correct but it is currently at http://stjohnsuccjonestown.org/beta/test/post.php[/quote]

how about the link for your html file?
#43

[eluser]millercj[/eluser]
sure that's at http://stjohnsuccjonestown.org/beta/test/test.php
#44

[eluser]paulopmx[/eluser]
[quote author="millercj" date="1207207590"]sure that's at http://stjohnsuccjonestown.org/beta/test/test.php[/quote]

ok found problem "test" is not defined.

either remove it from
Code:
buttons : [
                {name: 'Add', bclass: 'add', onpress : test},
                {name: 'Delete', bclass: 'delete', onpress : test}
                ],

into

Code:
buttons : [
                {name: 'Add', bclass: 'add'},
                {name: 'Delete', bclass: 'delete'}
                ],

or make a function

Code:
function test(com,grid)
            {
                alert(com);                
            }
#45

[eluser]millercj[/eluser]
removed it, still nothing.
#46

[eluser]paulopmx[/eluser]
Ok try this

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">"http://www.w3.org/TR/html4/strict.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Phone Directory&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="css/flexigrid/flexigrid.css"&gt;




&lt;/head&gt;
&lt;body&gt;

<table id="flex1" style="display:none"></table>

// put script tag here

           $("#flex1").flexigrid
            (
            {
            url: 'post.php',
            dataType: 'xml',
            colModel : [
                {display: 'id', name : 'id', width : 100, sortable : true, align: 'left'},
                {display: 'fname', name : 'fname', width : 100, sortable : true, align: 'left'},
                {display: 'lname', name : 'lname', width : 100, sortable : true, align: 'left'},
                ],
            buttons : [
                {name: 'Add', bclass: 'add'},
                {name: 'Delete', bclass: 'delete'},
                {separator: true}
                ],
            searchitems : [
                {display: 'ISO', name : 'iso'},
                {display: 'Name', name : 'name', isdefault: true}
                ],
            sortname: "lname",
            sortorder: "asc",
            usepager: true,
            title: 'Directory',
            useRp: true,
            rp: 15,
            showTableToggleBtn: true,
            width: 700,
            height: 200
            }
            );  

//close script tag here

&lt;/body&gt;
&lt;/html&gt;
#47

[eluser]millercj[/eluser]
That did it! thank you!

the only thing is that the search command doesn't work...i changed it to

searchitems : [
{display: 'fname', name : 'fname'},
{display: 'lname', name : 'lname', isdefault: true}
],
#48

[eluser]paulopmx[/eluser]
Insert this in your post.php, just look at it carefully where you should insert it:

Code:
$page = $_POST['page'];
$rp = $_POST['rp'];
$sortname = $_POST['sortname'];
$sortorder = $_POST['sortorder'];

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

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

if (!$page) $page = 1;
if (!$rp) $rp = 10;

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

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

//added code

$query = $_POST['query'];
$qtype = $_POST['qtype'];

$where = "";
if ($query) $where = " WHERE $qtype LIKE '%$query%' ";

$sql = "SELECT iso,name,printable_name,iso3,numcode FROM country $where $sort $limit";
$result = runSQL($sql);

//modified code

$total = countRec("iso","country $where");
#49

[eluser]slith[/eluser]
awesome job with this script paulo! just wondering...is there a way to hide /toggle the grid by default when the page loads?
#50

[eluser]millercj[/eluser]
you are the man, many many thanks!




Theme © iAndrew 2016 - Forum software by © MyBB