Skip to content

marcusorjames/cholesterol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Fattening up your cakephp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%