This repository has been archived by the owner on Oct 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
64 lines (50 loc) · 1.71 KB
/
README
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Cholesterol Plugin Version 0.1
------------------------------
This plugin currently only contains jqGrid components and helper.
Requirement
-----------
jQuery + UI (tested on 1.7.2) - http://jquery.com/
jqGrid (tested on version 3.5.3) - http://www.trirand.com/blog/?page_id=6
Tested with cakephp 1.3. May work with 1.2.5.
Demo of this plugin is currently available in http://chavik.com/cholesterolized
The demo source code can be found in http://github.com/rchavik/cholestorized
For the impatient, use the following example as a starting point:
<?php
// controllers/users_controller.php
class UsersController extends AppController {
// add Jqgrid component and helpers in your class variables.
var $components = array('Cholesterol.Jqgrid');
var $helpers = array('Cholesterol.Jqgrid');
// controllers/users_controller.php - action that displays the grid
function list_users() {
}
// Retrieve data for the grid in Json format
function get_list_users() {
// Perform the actual query using JqgridComponent and prepare
// the JSON response for the grid.
$this->Jqgrid->find('User');
}
?>
<?php
// views/users/list_users.ctp
echo $jqgrid->grid('user');
// Minimal configuration required to setup jqgrid initialization
// The format of $options array follows jqgrid configuration
// NOTE: javascript blocks (eg: for event handling) needs to be enclosed
// with <script> and </script>
// If anyone has better solution for this, please let me know
echo $jqgrid->script('user', array(
'url' => '/users/get_list_users.json',
'loadComplete' => '
<script>
function() {
alert("Your grid has been loaded successfully");
}
</script>
'
)
);
?>
Note: I still consider this plugin as very unstable.
Good luck and have fun.
-- rchavik