diff --git a/.gitignore b/.gitignore
index 0f77d9e..2b201b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,49 @@
*/cache/*
!*/cache/index.html
!*/cache/.htaccess
+/nbproject/private/
+.DS_Store
+
+application/cache/*
+application/logs/*
+/vendor/
+
+# IDE Files
+#-------------------------
+/nbproject/
+.idea/*
+
+## Sublime Text cache files
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
+
+# CI Project
+#-------------------------
+.gitignore
+contributing.md
+index.php
+/system/*
+application/config/*
+application/core/*
+application/helpers/*
+application/hooks/*
+application/language/*
+application/models/*
+application/third_party/*
+application/views/*
+!application/libraries/SmartGrid/*
+/license.txt
+/readme.rst
+/application/.htaccess
+/application/index.html
+/application/controllers/Welcome.php
+/application/controllers/index.html
+/application/libraries/index.html
+!/application/views/example_smartgrid.php
+/mpp.txt
+!/application/views/smartgrid_and_datatables.php
+!/application/views/example_smartgrid_arraygrid.php
+!/application/config/smartgrid.php
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 43276f1..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-language: php
-
-php:
- - 5.2
- - 5.3
- - 5.4
- - 5.5
- - 5.6
- - hhvm
-
-env:
- - DB=mysql
-
-before_script:
- - composer self-update
- - composer install --prefer-source --no-interaction --dev
-
-script: phpunit
-
-# allow_failures: Allow this build to fail under the specified environments.
-# fast_finish: If your build fails do not continue trying to build, just stop.
-matrix:
- allow_failures:
- - php: 5.6
- - php: hhvm
- fast_finish: true
-
-notifications:
- on_success: never
- on_failure: never
\ No newline at end of file
diff --git a/README.md b/README.md
index 28f6da8..c2991c6 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
-# SmartGrid for CodeIgniter with Bootstrap
-A simple PHP datagrid control for CodeIgniter framework with Bootstrap.
+# CodeIgniter SmartGrid
+### A simple PHP datagrid control for CodeIgniter with Bootstrap support
+
+
SmartGrid focus on data display than data manipulation.
We are starting with limited features to make the code very simple and robust,
yet we will be adding more feature on the go. The code is very simple and well documented, which make it easy for customization.
@@ -79,7 +81,7 @@ Limitations
Version
-----
-**SmartGrid v0.6.1-beta**
+**SmartGrid v0.6.5-beta**
> Notice:- SmartGrid is on beta version, usage on production environment is not recommended unless tested well.
> Please report issue at [github issues](https://github.com/techlab/codeigniter-smartgrid/issues/)
diff --git a/application/config/smartgrid.php b/application/config/smartgrid.php
new file mode 100644
index 0000000..d068bf3
--- /dev/null
+++ b/application/config/smartgrid.php
@@ -0,0 +1,25 @@
+input->get_post('employee_name', TRUE));
-
- // Load the SmartGrid Library
- $this->load->library('SmartGrid/Smartgrid');
-
+ $employee_name = $this->input->post_get('employee_name', TRUE);
+ $data['employee_name'] = $employee_name;
// SQl for grid
$where = '';
$where .= !empty($employee_name) ? " AND employee_name LIKE '%$employee_name%' " : "";
@@ -24,26 +21,28 @@ public function index()
"2"=>"Female"
);
+ $buttons_html = '
';
+
// Column settings
$columns = array(
- "employee_id"=>array("header"=>"Employee ID", "type"=>"label", "align"=>"left", "width"=>"100px"),
- "employee_name"=>array("header"=>"Employee Name", "type"=>"label", "align"=>"left", "width"=>"150px"),
- "employee_dob"=>array("header"=>"Date of Birth", "type"=>"date", "align"=>"center", "width"=>"150px", "date_format"=>"Y-m-d", "date_format_from"=>"Y-m-d H:i:s"),
- "employee_join_date"=>array("header"=>"Join Date", "type"=>"relativedate", "align"=>"left", "width"=>"150px"),
- "employee_gender"=>array("header"=>"Gender", "type"=>"enum", "source"=>$gender_list, "align"=>"center", "width"=>"100px"),
- "employee_salary"=>array("header"=>"Salary", "type"=>"money", "sign"=>"$", "align"=>"right", "width"=>"100px"),
- "performance_index"=>array("header"=>"Performance", "type"=>"progressbar", "align"=>"center", "width"=>"100px"),
- // "employee_img_url"=>array("header"=>"Image", "type"=>"image", "align"=>"center", "width"=>"50px", "image_width"=>"50px"),
+ "employee_id"=>array("type"=>"label", "header"=>"Employee ID", "align"=>"left", "width"=>"100px"),
+ "employee_name"=>array("type"=>"label", "header"=>"Employee Name", "align"=>"left", "width"=>""),
+ "employee_dob"=>array("type"=>"date", "header"=>"Date of Birth", "align"=>"center", "header_align"=>"center", "width"=>"150px", "date_format"=>"Y-m-d", "date_format_from"=>"Y-m-d H:i:s"),
+ "employee_join_date"=>array("type"=>"relativedate", "header"=>"Join Date", "align"=>"left", "width"=>"100px"),
+ "employee_gender"=>array("type"=>"enum", "header"=>"Gender", "source"=>$gender_list, "align"=>"center", "width"=>"80px"),
+ "employee_salary"=>array("type"=>"money", "header"=>"Salary", "sign"=>"$", "align"=>"right", "width"=>"100px"),
+ "performance_index"=>array("type"=>"progressbar", "header"=>"Performance", "align"=>"center", "width"=>"150px", "style" => "progress-bar-info"),
+ "employee_img_url"=>array("type"=>"custom", "header"=>"Buttons", "field_data"=>$buttons_html, "align"=>"center", "width"=>"130px"),
);
// Config settings, optional
$config = array("page_size"=> 5,
- "grid_name"=> "sg_1",
"toolbar_position"=> 'both');
+ // Load the SmartGrid Library
+ $this->load->library('SmartGrid/Smartgrid');
// Set the grid
$this->smartgrid->set_grid($sql, $columns, $config);
-
// Render the grid and assign to data array, so it can be print to on the view
$data['grid_html'] = $this->smartgrid->render_grid();
diff --git a/application/libraries/SmartGrid/Smartgrid.php b/application/libraries/SmartGrid/Smartgrid.php
index 5d416f6..f556096 100644
--- a/application/libraries/SmartGrid/Smartgrid.php
+++ b/application/libraries/SmartGrid/Smartgrid.php
@@ -1,9 +1,10 @@
CI =& get_instance();
+ // Load url helper
$this->CI->load->helper('url');
+ $this->set_debug_time('grid_start_time');
+
+ // Load configuration from file if avaliable
+ $this->CI->load->config('smartgrid', TRUE, TRUE);
+ if (is_array($this->CI->config->item('smartgrid')))
+ {
+ $this->set_configs($this->CI->config->item('smartgrid'));
+ }
+
+ // Load configuration from parameter if provided
empty($config) OR $this->set_configs($config);
}
@@ -136,13 +160,25 @@ public function set_grid($data_or_sql, $columns = array(), $config = null)
{
if(empty($data_or_sql)) { return false; }
+ $this->set_debug_time('set_start_time');
+
empty($config) OR $this->set_configs($config);
$this->_current_url = current_url();
- $this->_current_url .= $_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : '';
+ //$this->_current_url .= $_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : '';
+
+ $page_number = $this->CI->input->get_post($this->_config_grid_name.'page', TRUE);
+ $this->_page_number = isset($page_number) ? $page_number : 1;
+ $this->set_debug_time('data_start_time');
+ // Set data
$this->set_data($data_or_sql);
+ $this->set_debug_time('data_end_time');
+
+ // Set columns
$this->set_columns($columns);
+
+ $this->set_debug_time('set_end_time');
return true;
}
@@ -155,6 +191,7 @@ public function set_grid($data_or_sql, $columns = array(), $config = null)
*/
public function render_grid()
{
+ $this->set_debug_time('render_start_time');
$paging_html = ($this->_config_paging_enabled === true) ? '