forked from optikalefx/OpenJS-Grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
41 lines (33 loc) · 972 Bytes
/
ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// connect to db
mysql_connect("localhost","root","root");
mysql_select_db("test");
// require our class
require_once("grid.php");
// load our grid with a table
$grid = new Grid("tutorials", array(
"save"=>true,
"delete"=>true,
"where"=>"ThumbnailLocation != ''",
"joins"=>array(
"LEFT JOIN categories ON categories.CategoryID = tutorials.CategoryID"
),
"fields"=>array(
"thumb" => "CONCAT('http://cmivfx.com/images/thumbs/',ThumbnailLocation)"
),
"select" => 'selectFunction'
));
// drop down function
// if you have anonymous function support, then you can just put this function in place of
// 'selectFunction'
function selectFunction($grid) {
$selects = array();
// category select
$grid->table = "categories";
$selects["CategoryID"] = $grid->makeSelect("CategoryID","Name");
// active select
$selects["active"] = array("1"=>"true","0"=>"false");
// render data
$grid->render($selects);
}
?>