|
|
 Michael Quinn - 2011-02-04 16:18:31
$project = $_GET['project'] ;
class mysrc extends drasticSrcMySQL {
protected function select(){
global $project;
// $res = mysql_query("SELECT * FROM $this->table WHERE product = '".$project."' ". $this->orderbystr, $this->conn) or die(mysql_error());
$res = mysql_query ("SELECT * FROM $this->table WHERE product = '".$project."' ". $this->orderbystr , $this->conn ) or die ( Mysql_error ());
return ($res);
}
protected function add(){
mysql_query("INSERT INTO $this->table (product) VALUES('".$_GET['project']."')", $this->conn) or die(mysql_error());
if (mysql_affected_rows($this->conn) == 1) return(true); else return(false);
}
}
$options = array(
"add_allowed" => true,
"delete_allowed" => true,
"editablecols" => array("product","category","issue","issueversion","status","versioniffixed","comments"),
"sortcol" => "status",
"sort" => "open"
);
$src = new mysrc($server, $user, $pw, $db, $table, $options);
The above code is the php
The below is the javascript
---------------
var thegrid = new drasticGrid('grid2', {pathimg:"img/", pagelength:10,sortcol:"product",
columns: [
{name: 'id',displayname:'ID',width: 30},
{name: 'product',displayname:'Product', type: DDTYPEKEY, values:[<?php echo $list; ?>], labels:[<?php echo $list; ?>], width: 80},
{name: 'category',displayname:'Category',width: 70},
{name: 'issue', displayname:'Issue', type: DDTYPETEXT, width: 230, editable: true},
{name: 'issueversion',displayname:'Issue Version',width: 30},
{name: 'status',displayname:'Status',width: 50},
{name: 'versioniffixed',displayname:'Version if fixes',width: 30},
{name: 'comments', displayname:'Comments',type: DDTYPETEXT, width: 230, editable: true},
]
});
--------
I cant seem to get this working im sending the page a project and it wont select by the project is it something im doing wrong
 dd - 2011-02-04 21:40:11 - In reply to message 1 from Michael Quinn
 Michael Quinn - 2011-02-08 15:53:42 - In reply to message 2 from dd
Great thanks for the info that worked a treat!!!
I have another issue !!
1.
I want it to return all rows without scrollbar or pagination, can this be done? even when adding new rows?
so the length of the display rows is equal to that of the return rows.
Again thanks for all the help!
Regards,
Mike
 dd - 2011-02-11 12:38:03 - In reply to message 3 from Michael Quinn
Michael,
Glad it works.
Returning all rows without scrollbar or pagination even after add, can certainly be done, but it involves some recoding in the javascript file (and maybe the php file, don't know) to prevent the grid from partitioning the data into page chunks.
If you want to do that yourself, I suggest to start in the refresh function of drasticgrid.js.
If you want us to do it, contact us directly (www.drasticdata.nl).
best regards,
dd
|