Skip to content
Browse files

Add primary key support; Reformat code

  • Loading branch information...
1 parent ad89fee commit 572b25fa3e6d00248b43561b5e6dd1e8eccc19d5 WR committed Jan 12, 2013
Showing with 6,041 additions and 5,721 deletions.
  1. +20 −7 client/jqgrid-ext.js
  2. +5 −5 examples/config.php
  3. +89 −89 examples/grids/jqCols.php
  4. +80 −80 examples/grids/jqExceptionOper.php
  5. +51 −51 examples/grids/jqExceptionOutput.php
  6. +51 −51 examples/grids/jqExceptionRender.php
  7. +57 −57 examples/grids/jqGeneral.php
  8. +33 −33 examples/grids/jqMiscAjaxDialog.php
  9. +39 −39 examples/grids/jqMiscAjaxDialogDetails.php
  10. +113 −113 examples/grids/jqMiscDatepickers.php
  11. +57 −57 examples/grids/jqMiscGroupHeader.php
  12. +64 −64 examples/grids/jqMiscGroupHeaderEx.php
  13. +51 −51 examples/grids/jqMiscSubgrid.php
  14. +51 −51 examples/grids/jqMiscSubgrid2.php
  15. +32 −32 examples/grids/jqMssql.php
  16. +60 −60 examples/grids/jqOperBasic.php
  17. +39 −39 examples/grids/jqOperCustom.php
  18. +131 −131 examples/grids/jqOperUpload.php
  19. +119 −119 examples/grids/jqOutAdvancedSearch.php
  20. +31 −31 examples/grids/jqOutComplex.php
  21. +38 −38 examples/grids/jqOutExcel.php
  22. +119 −119 examples/grids/jqOutSearch.php
  23. +45 −45 examples/grids/jqOutSort.php
  24. +52 −52 examples/grids/jqOutTree.php
  25. +78 −78 examples/grids/jqOutTreeFull.php
  26. +56 −0 examples/grids/jqPrimaryId.php
  27. +60 −0 examples/grids/jqPrimaryMulti.php
  28. +54 −54 examples/grids/jqRender1.php
  29. +59 −59 examples/grids/jqRender2.php
  30. +43 −43 examples/grids/jqRenderData.php
  31. +51 −51 examples/grids/jqSimple.php
  32. +121 −121 examples/grids/jqWelcome.php
  33. +3 −3 examples/index.php
  34. +190 −0 examples/misc/countries.txt
  35. +168 −146 examples/misc/test_data_generator.php
  36. +66 −52 examples/sections.php
  37. +11 −10 examples/templates/_accordion.php
  38. +130 −99 examples/templates/_layout.php
  39. +26 −26 examples/templates/_sources.php
  40. +17 −14 examples/templates/jqCols.php
  41. +4 −4 examples/templates/jqExceptionOper.php
  42. +4 −4 examples/templates/jqExceptionOutput.php
  43. +7 −7 examples/templates/jqExceptionRender.php
  44. +16 −17 examples/templates/jqGeneral.php
  45. +33 −36 examples/templates/jqMiscAjaxDialog.php
  46. +17 −20 examples/templates/jqMiscDatepickers.php
  47. +16 −14 examples/templates/jqMiscGroupHeader.php
  48. +24 −28 examples/templates/jqMiscGroupHeaderEx.php
  49. +18 −19 examples/templates/jqMiscSubgrid.php
  50. +5 −5 examples/templates/jqMssql.php
  51. +14 −14 examples/templates/jqOperBasic.php
  52. +30 −31 examples/templates/jqOperCustom.php
  53. +18 −19 examples/templates/jqOperUpload.php
  54. +27 −27 examples/templates/jqOutAdvancedSearch.php
  55. +11 −10 examples/templates/jqOutComplex.php
  56. +29 −29 examples/templates/jqOutExcel.php
  57. +26 −26 examples/templates/jqOutSearch.php
  58. +8 −8 examples/templates/jqOutSort.php
  59. +19 −18 examples/templates/jqOutTree.php
  60. +12 −12 examples/templates/jqOutTreeFull.php
  61. +11 −0 examples/templates/jqPrimaryId.php
  62. +12 −0 examples/templates/jqPrimaryMulti.php
  63. +32 −33 examples/templates/jqRender1.php
  64. +6 −6 examples/templates/jqRender2.php
  65. +3 −3 examples/templates/jqRenderData.php
  66. +6 −6 examples/templates/jqSimple.php
  67. +7 −7 examples/templates/jqWelcome.php
  68. +107 −107 php/Adapter/CSV.php
  69. +32 −32 php/Adapter/Mssql.php
  70. +40 −40 php/Adapter/Oracle.php
  71. +0 −156 php/Adapter/ReadRu.php
  72. +257 −256 php/DB/DB.php
  73. +7 −7 php/DB/Mssql.php
  74. +70 −70 php/DB/Mysql.php
  75. +57 −57 php/DB/Pdo.php
  76. +51 −51 php/DB/Pgsql.php
  77. +32 −32 php/DB/ReadRu.php
  78. +10 −10 php/Data/Data.php
  79. +4 −4 php/Data/Raw.php
  80. +19 −19 php/Data/Value.php
  81. +1 −1 php/Exception/DB.php
  82. +21 −21 php/Exception/Exception.php
  83. +6 −6 php/Exception/Render.php
  84. +94 −94 php/Export/ExcelHtml.php
  85. +141 −141 php/Export/ExcelXml.php
  86. +15 −14 php/Export/Export.php
  87. +130 −130 php/Utils/Utils.php
  88. +1,751 −1,679 php/jqGrid.php
  89. +221 −221 php/jqGridLoader.php
View
27 client/jqgrid-ext.js
@@ -1,14 +1,10 @@
//---------------
-// Overrride some defaults
+// Override some defaults
//---------------
$.extend($.jgrid.defaults,
{
- 'datatype' : 'json',
- 'mtype' : 'POST',
- 'loadui' : 'block',
-
- 'loadComplete' : function(data)
+ loadComplete : function(data)
{
$.jgrid.ext.errorHandler(data);
}
@@ -135,7 +131,24 @@ $.extend($.jgrid.edit,
return [true, null, new_id];
},
- recreateForm : true //recreating form removes a lot of butthurt of form editing
+ recreateForm : true
+});
+
+$.extend($.jgrid.del,
+{
+ afterSubmit: function(data)
+ {
+ var json = $.jgrid.parse(data.responseText);
+
+ if(typeof(json.error_msg) != 'undefined')
+ {
+ return [false, json.error_msg, 0];
+ }
+
+ return [true, null, 0];
+ },
+
+ recreateForm : true
});
//---------------
View
10 examples/config.php
@@ -2,11 +2,11 @@
$lang = 'ru';
$_CONFIG = array(
- 'root_path' => dirname(__FILE__) . '/../php/',
+ 'root_path' => dirname(__FILE__) . '/../php/',
- 'encoding' => 'utf-8',
+ 'encoding' => 'utf-8',
- 'pdo_dsn' => 'mysql:dbname=jqgrid_test;host=127.0.0.1',
- 'pdo_user' => 'root',
- 'pdo_pass' => '',
+ 'pdo_dsn' => 'mysql:dbname=jqgrid_test;host=127.0.0.1',
+ 'pdo_user' => 'root',
+ 'pdo_pass' => '',
);
View
178 examples/grids/jqCols.php
@@ -2,14 +2,14 @@
class jqCols extends jqGrid
{
- protected function init()
- {
- $this->options = array(
- 'sortname' => 'book_id',
- 'sortorder' => 'asc',
- );
-
- $this->query = "
+ protected function init()
+ {
+ $this->options = array(
+ 'sortname' => 'book_id',
+ 'sortorder' => 'asc',
+ );
+
+ $this->query = "
SELECT {fields}
FROM tbl_order_item i
JOIN tbl_order o ON (i.order_id=o.id)
@@ -18,85 +18,85 @@ protected function init()
WHERE {where}
";
- #Set columns
- $this->cols = array(
-
- #Real id is hidden
- 'id' =>array('hidden'=> true,
- 'db' => 'i.id',
- ),
-
- #This column is constructed by SQL-expression
- #Searching and sorting still works!
- 'c_name' =>array('label' => 'Customer name',
- 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
- 'width' => 35,
- ),
-
- 'book_id' =>array('label' => 'Book ID',
- 'db' => 'b.id',
- 'width' => 10,
- 'align' => 'center',
- 'formatter' => 'integer',
- ),
-
- 'book_name' =>array('label' => 'Book Name',
- 'db' => 'b.name',
- 'width' => 30,
- ),
-
- 'quantity' =>array('label' => 'Quantity',
- 'db' => 'i.quantity',
- 'db_agg'=> 'sum',
- 'width' => 10,
- 'formatter' => 'integer',
- 'align' => 'center',
- ),
-
- #Field with same name, but different tables
- 'orig_price' =>array('label' => 'Orig price',
- 'db' => 'b.price', #price from 1st table
- 'db_agg' => 'sum',
- 'width' => 14,
- 'formatter' => 'integer',
- 'align' => 'right',
- ),
-
- 'item_price' =>array('label' => 'Item price',
- 'db' => 'i.price', #price from 2nd table
- 'db_agg' => 'sum', #avg price for all items
- 'width' => 14,
- 'formatter' => 'integer',
- 'align' => 'right',
- ),
-
-
- #This column is processed MANUALLY in PHP code
- 'diff_price' =>array('label' => 'Diff',
- 'manual'=> true,
- 'width' => 12,
- 'search' => false,
- 'sortable' => false,
- 'align' => 'right',
- ),
-
- #This column exists only in PHP code
- 'discount' =>array('db' => 'c.discount',
- 'unset' => true,
- ),
- );
-
- $this->render_filter_toolbar = true;
- }
-
- protected function parseRow($r)
- {
- #Calc diff_price in PHP
- $r['diff_price'] = $r['orig_price'] - $r['item_price'];
-
- #Highlight customers with discount > 0.1
- $r['_class'] = array('c_name' => ($r['discount'] > 0.1) ? 'bold font-green' : null);
-
- return $r;
- }
+ #Set columns
+ $this->cols = array(
+
+ #Real id is hidden
+ 'id' => array('hidden' => true,
+ 'db' => 'i.id',
+ ),
+
+ #This column is constructed by SQL-expression
+ #Searching and sorting still works!
+ 'c_name' => array('label' => 'Customer name',
+ 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
+ 'width' => 35,
+ ),
+
+ 'book_id' => array('label' => 'Book ID',
+ 'db' => 'b.id',
+ 'width' => 10,
+ 'align' => 'center',
+ 'formatter' => 'integer',
+ ),
+
+ 'book_name' => array('label' => 'Book Name',
+ 'db' => 'b.name',
+ 'width' => 30,
+ ),
+
+ 'quantity' => array('label' => 'Quantity',
+ 'db' => 'i.quantity',
+ 'db_agg' => 'sum',
+ 'width' => 10,
+ 'formatter' => 'integer',
+ 'align' => 'center',
+ ),
+
+ #Field with same name, but different tables
+ 'orig_price' => array('label' => 'Orig price',
+ 'db' => 'b.price', #price from 1st table
+ 'db_agg' => 'sum',
+ 'width' => 14,
+ 'formatter' => 'integer',
+ 'align' => 'right',
+ ),
+
+ 'item_price' => array('label' => 'Item price',
+ 'db' => 'i.price', #price from 2nd table
+ 'db_agg' => 'sum', #avg price for all items
+ 'width' => 14,
+ 'formatter' => 'integer',
+ 'align' => 'right',
+ ),
+
+
+ #This column is processed MANUALLY in PHP code
+ 'diff_price' => array('label' => 'Diff',
+ 'manual' => true,
+ 'width' => 12,
+ 'search' => false,
+ 'sortable' => false,
+ 'align' => 'right',
+ ),
+
+ #This column exists only in PHP code
+ 'discount' => array('db' => 'c.discount',
+ 'unset' => true,
+ ),
+ );
+
+ $this->render_filter_toolbar = true;
+ }
+
+ protected function parseRow($r)
+ {
+ #Calc diff_price in PHP
+ $r['diff_price'] = $r['orig_price'] - $r['item_price'];
+
+ #Highlight customers with discount > 0.1
+ $r['_class'] = array('c_name' => ($r['discount'] > 0.1) ? 'bold font-green' : null);
+
+ return $r;
+ }
}
View
160 examples/grids/jqExceptionOper.php
@@ -2,84 +2,84 @@
class jqExceptionOper extends jqGrid
{
- protected function init()
- {
- #Set database table
- $this->table = 'tbl_customer';
-
- #Make all columns editable by default
- $this->cols_default = array('editable' => true);
-
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- 'editable' => false, //id is non-editable
- ),
-
- 'first_name'=>array('label' => 'First name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- 'formoptions' => array('suffix' => 'gg'),
- ),
-
- 'last_name' =>array('label' => 'Last name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- ),
-
- 'email' =>array('label' => 'Email',
- 'width' => 30,
- 'editrules' => array('email' => true),
- ),
-
- 'phone' =>array('label' => 'Phone',
- 'width' => 25,
- 'align' => 'center',
- ),
-
- 'discount' =>array('label' => 'Discount',
- 'width' => 15,
- 'formatter' => 'numeric',
- 'align' => 'center',
- 'editable' => false,
- ),
- );
-
- #Set nav
- $this->nav = array('add' => true, 'edit' => false, 'del' => false);
- }
-
- protected function operData($r)
- {
- if(strlen($r['first_name']) < 3)
- {
- throw new jqGrid_Exception('First name is too short');
- }
-
- if(strlen($r['last_name']) < 3)
- {
- throw new jqGrid_Exception('Last name is too short');
- }
-
- #Email already exists?
- $result = $this->DB->query("SELECT id FROM {$this->table} WHERE email=" . $this->DB->quote($r['email']));
-
- if($this->DB->fetch($result))
- {
- throw new jqGrid_Exception('Email already exists');
- }
-
- #Phone has letters?
- if($r['phone'] and preg_match('#[^0-9]#', $r['phone']))
- {
- throw new jqGrid_Exception('Phone number must contain only numbers');
- }
-
- throw new jqGrid_Exception('You have passed all requirements! But operation fails anyway for example purpose.');
-
- return $r;
- }
+ protected function init()
+ {
+ #Set database table
+ $this->table = 'tbl_customer';
+
+ #Make all columns editable by default
+ $this->cols_default = array('editable' => true);
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ 'editable' => false, //id is non-editable
+ ),
+
+ 'first_name' => array('label' => 'First name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ 'formoptions' => array('suffix' => 'gg'),
+ ),
+
+ 'last_name' => array('label' => 'Last name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ ),
+
+ 'email' => array('label' => 'Email',
+ 'width' => 30,
+ 'editrules' => array('email' => true),
+ ),
+
+ 'phone' => array('label' => 'Phone',
+ 'width' => 25,
+ 'align' => 'center',
+ ),
+
+ 'discount' => array('label' => 'Discount',
+ 'width' => 15,
+ 'formatter' => 'numeric',
+ 'align' => 'center',
+ 'editable' => false,
+ ),
+ );
+
+ #Set nav
+ $this->nav = array('add' => true, 'edit' => false, 'del' => false);
+ }
+
+ protected function operData($r)
+ {
+ if(strlen($r['first_name']) < 3)
+ {
+ throw new jqGrid_Exception('First name is too short');
+ }
+
+ if(strlen($r['last_name']) < 3)
+ {
+ throw new jqGrid_Exception('Last name is too short');
+ }
+
+ #Email already exists?
+ $result = $this->DB->query("SELECT id FROM {$this->table} WHERE email=" . $this->DB->quote($r['email']));
+
+ if($this->DB->fetch($result))
+ {
+ throw new jqGrid_Exception('Email already exists');
+ }
+
+ #Phone has letters?
+ if($r['phone'] and preg_match('#[^0-9]#', $r['phone']))
+ {
+ throw new jqGrid_Exception('Phone number must contain only numbers');
+ }
+
+ throw new jqGrid_Exception('You have passed all requirements! But operation fails anyway for example purpose.');
+
+ return $r;
+ }
}
View
102 examples/grids/jqExceptionOutput.php
@@ -2,63 +2,63 @@
class jqExceptionOutput extends jqGrid
{
- protected function init()
- {
- #Set database table
- $this->table = 'tbl_customer';
+ protected function init()
+ {
+ #Set database table
+ $this->table = 'tbl_customer';
- #Make all columns editable by default
- $this->cols_default = array('editable' => true);
+ #Make all columns editable by default
+ $this->cols_default = array('editable' => true);
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- 'editable' => false, //id is non-editable
- ),
+ #Set columns
+ $this->cols = array(
- 'first_name'=>array('label' => 'First name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- 'formoptions' => array('suffix' => 'gg'),
- ),
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ 'editable' => false, //id is non-editable
+ ),
- 'last_name' =>array('label' => 'Last name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- ),
+ 'first_name' => array('label' => 'First name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ 'formoptions' => array('suffix' => 'gg'),
+ ),
- 'email' =>array('label' => 'Email',
- 'width' => 30,
- 'editrules' => array('email' => true),
- ),
+ 'last_name' => array('label' => 'Last name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ ),
- 'phone' =>array('label' => 'Phone',
- 'width' => 25,
- 'align' => 'center',
- ),
+ 'email' => array('label' => 'Email',
+ 'width' => 30,
+ 'editrules' => array('email' => true),
+ ),
- 'discount' =>array('label' => 'Discount',
- 'width' => 15,
- 'formatter' => 'numeric',
- 'align' => 'center',
- 'editable' => false,
- ),
- );
+ 'phone' => array('label' => 'Phone',
+ 'width' => 25,
+ 'align' => 'center',
+ ),
- #Set nav
- $this->nav = array('add' => true, 'edit' => false, 'del' => false);
- }
-
- protected function search()
- {
- if($this->input['first_name'])
- {
- throw new jqGrid_Exception('You cannot use filter for field "first_name"');
- }
-
- parent::search();
- }
+ 'discount' => array('label' => 'Discount',
+ 'width' => 15,
+ 'formatter' => 'numeric',
+ 'align' => 'center',
+ 'editable' => false,
+ ),
+ );
+
+ #Set nav
+ $this->nav = array('add' => true, 'edit' => false, 'del' => false);
+ }
+
+ protected function search()
+ {
+ if($this->input['first_name'])
+ {
+ throw new jqGrid_Exception('You cannot use filter for field "first_name"');
+ }
+
+ parent::search();
+ }
}
View
102 examples/grids/jqExceptionRender.php
@@ -2,63 +2,63 @@
class jqExceptionRender extends jqGrid
{
- protected function init()
- {
- #Set database table
- $this->table = 'tbl_customer';
+ protected function init()
+ {
+ #Set database table
+ $this->table = 'tbl_customer';
- #Make all columns editable by default
- $this->cols_default = array('editable' => true);
+ #Make all columns editable by default
+ $this->cols_default = array('editable' => true);
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- 'editable' => false, //id is non-editable
- ),
+ #Set columns
+ $this->cols = array(
- 'first_name'=>array('label' => 'First name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- 'formoptions' => array('suffix' => 'gg'),
- ),
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ 'editable' => false, //id is non-editable
+ ),
- 'last_name' =>array('label' => 'Last name',
- 'width' => 35,
- 'editrules' => array('required' => true),
- ),
+ 'first_name' => array('label' => 'First name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ 'formoptions' => array('suffix' => 'gg'),
+ ),
- 'email' =>array('label' => 'Email',
- 'width' => 30,
- 'editrules' => array('email' => true),
- ),
+ 'last_name' => array('label' => 'Last name',
+ 'width' => 35,
+ 'editrules' => array('required' => true),
+ ),
- 'phone' =>array('label' => 'Phone',
- 'width' => 25,
- 'align' => 'center',
- ),
+ 'email' => array('label' => 'Email',
+ 'width' => 30,
+ 'editrules' => array('email' => true),
+ ),
- 'discount' =>array('label' => 'Discount',
- 'width' => 15,
- 'formatter' => 'numeric',
- 'align' => 'center',
- 'editable' => false,
- ),
- );
+ 'phone' => array('label' => 'Phone',
+ 'width' => 25,
+ 'align' => 'center',
+ ),
- #Set nav
- $this->nav = array('add' => true, 'edit' => false, 'del' => false);
- }
-
- protected function renderComplete($data)
- {
- if(!isset($data['foo_bar']))
- {
- throw new jqGrid_Exception_Render('Not enough data to render grid');
- }
-
- parent::renderComplete($data);
- }
+ 'discount' => array('label' => 'Discount',
+ 'width' => 15,
+ 'formatter' => 'numeric',
+ 'align' => 'center',
+ 'editable' => false,
+ ),
+ );
+
+ #Set nav
+ $this->nav = array('add' => true, 'edit' => false, 'del' => false);
+ }
+
+ protected function renderComplete($data)
+ {
+ if(!isset($data['foo_bar']))
+ {
+ throw new jqGrid_Exception_Render('Not enough data to render grid');
+ }
+
+ parent::renderComplete($data);
+ }
}
View
114 examples/grids/jqGeneral.php
@@ -2,61 +2,61 @@
class jqGeneral extends jqGrid
{
- protected function init()
- {
- #Set database table
- $this->table = 'tbl_customer';
-
- $this->cols_default = array('editable' => true);
-
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- 'editable' => false,
- 'search_op' => 'in',
- ),
-
- 'first_name'=>array('label' => 'First name',
- 'width' => 35,
- 'search_op' => 'in',
- ),
-
- 'last_name' =>array('label' => 'Last name',
- 'width' => 35,
- ),
-
- 'email' =>array('label' => 'Email',
- 'width' => 30,
- ),
-
- 'phone' =>array('label' => 'Phone',
- 'width' => 25,
- 'align' => 'center',
- ),
-
- 'discount' =>array('label' => 'Discount',
- 'width' => 15,
- 'formatter' => 'numeric',
- 'align' => 'center',
- ),
-
- 'date_register'=>array('label' => 'Register',
- 'width' => 20,
- 'formatter' => 'date',
- 'align' => 'center',
- ),
- );
-
- #Set nav
- $this->nav = array('add' => true, 'edit' => true, 'del' => true);
- }
-
- protected function operData($r)
- {
- throw new jqGrid_Exception('ohhh');
- return $r;
- }
+ protected function init()
+ {
+ #Set database table
+ $this->table = 'tbl_customer';
+
+ $this->cols_default = array('editable' => true);
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ 'editable' => false,
+ 'search_op' => 'in',
+ ),
+
+ 'first_name' => array('label' => 'First name',
+ 'width' => 35,
+ 'search_op' => 'in',
+ ),
+
+ 'last_name' => array('label' => 'Last name',
+ 'width' => 35,
+ ),
+
+ 'email' => array('label' => 'Email',
+ 'width' => 30,
+ ),
+
+ 'phone' => array('label' => 'Phone',
+ 'width' => 25,
+ 'align' => 'center',
+ ),
+
+ 'discount' => array('label' => 'Discount',
+ 'width' => 15,
+ 'formatter' => 'numeric',
+ 'align' => 'center',
+ ),
+
+ 'date_register' => array('label' => 'Register',
+ 'width' => 20,
+ 'formatter' => 'date',
+ 'align' => 'center',
+ ),
+ );
+
+ #Set nav
+ $this->nav = array('add' => true, 'edit' => true, 'del' => true);
+ }
+
+ protected function operData($r)
+ {
+ throw new jqGrid_Exception('ohhh');
+ return $r;
+ }
}
View
66 examples/grids/jqMiscAjaxDialog.php
@@ -2,44 +2,44 @@
class jqMiscAjaxDialog extends jqGrid
{
- protected function init()
- {
- $this->query = "
+ protected function init()
+ {
+ $this->query = "
SELECT {fields}
FROM tbl_customer c
JOIN tbl_order o ON (c.id=o.customer_id)
WHERE {where}
GROUP BY c.id
";
- #Set columns
- $this->cols = array(
- 'id' =>array('label' => 'ID',
- 'db' => 'c.id',
- 'width' => 10,
- 'align' => 'center',
- ),
-
- 'c_name' =>array('label' => 'Customer name',
- 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
- 'width' => 35,
- ),
-
- 'order_cnt' =>array('label' => 'Order count',
- 'db' => 'count(o.id)',
- 'width' => 15,
- ),
-
- 'order_latest' =>array('label' => 'Latest order',
- 'db' => 'max(o.date_create)',
- 'width' => 15,
- ),
- );
- }
-
- protected function opDialog()
- {
- $rendered_grid = $this->loader->render('jqMiscAjaxDialogDetails', array('customer_id' => $this->input('id')));
- $this->response['html'] = "<script> $rendered_grid </script>";
- }
+ #Set columns
+ $this->cols = array(
+ 'id' => array('label' => 'ID',
+ 'db' => 'c.id',
+ 'width' => 10,
+ 'align' => 'center',
+ ),
+
+ 'c_name' => array('label' => 'Customer name',
+ 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
+ 'width' => 35,
+ ),
+
+ 'order_cnt' => array('label' => 'Order count',
+ 'db' => 'count(o.id)',
+ 'width' => 15,
+ ),
+
+ 'order_latest' => array('label' => 'Latest order',
+ 'db' => 'max(o.date_create)',
+ 'width' => 15,
+ ),
+ );
+ }
+
+ protected function opDialog()
+ {
+ $rendered_grid = $this->Loader->render('jqMiscAjaxDialogDetails', array('customer_id' => $this->input('id')));
+ $this->response['html'] = "<script> $rendered_grid </script>";
+ }
}
View
78 examples/grids/jqMiscAjaxDialogDetails.php
@@ -2,49 +2,49 @@
class jqMiscAjaxDialogDetails extends jqGrid
{
- protected function init()
- {
- $this->options = array(
- 'width' => 496,
- 'height' => 185,
- 'rowNum' => -1,
- );
-
- $this->query = "
+ protected function init()
+ {
+ $this->options = array(
+ 'width' => 496,
+ 'height' => 185,
+ 'rowNum' => -1,
+ );
+
+ $this->query = "
SELECT {fields}
FROM tbl_order o
JOIN tbl_order_item i ON (o.id=i.order_id)
WHERE {where}
GROUP BY o.id
";
-
- $this->cols_default = array('align' => 'center');
-
- #Set columns
- $this->cols = array(
- 'id' =>array('label' => 'ID',
- 'db' => 'o.id',
- 'width' => 10,
- ),
-
- 'customer_id' =>array('hidden' => true), //to make auto-search work
-
- 'quantity' =>array('label' => 'Total quantity',
- 'db' => 'count(i.quantity)',
- 'width' => 15,
- ),
-
- 'price' =>array('label' => 'Total price',
- 'db' => 'sum(i.price * i.quantity)',
- 'width' => 15,
- ),
-
- 'date_create' =>array('label' => 'Date',
- 'db' => 'o.date_create',
- 'width' => 18,
- ),
- );
-
- $this->render_suffix_col = 'customer_id';
- }
+
+ $this->cols_default = array('align' => 'center');
+
+ #Set columns
+ $this->cols = array(
+ 'id' => array('label' => 'ID',
+ 'db' => 'o.id',
+ 'width' => 10,
+ ),
+
+ 'customer_id' => array('hidden' => true), //to make auto-search work
+
+ 'quantity' => array('label' => 'Total quantity',
+ 'db' => 'count(i.quantity)',
+ 'width' => 15,
+ ),
+
+ 'price' => array('label' => 'Total price',
+ 'db' => 'sum(i.price * i.quantity)',
+ 'width' => 15,
+ ),
+
+ 'date_create' => array('label' => 'Date',
+ 'db' => 'o.date_create',
+ 'width' => 18,
+ ),
+ );
+
+ $this->render_suffix_col = 'customer_id';
+ }
}
View
226 examples/grids/jqMiscDatepickers.php
@@ -2,117 +2,117 @@
class jqMiscDatepickers extends jqGrid
{
- protected function init()
- {
- $this->table = 'tbl_customer';
-
- #Set columns
- $this->cols = array(
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- ),
-
- 'c_name' =>array('label' => 'Customer name',
- 'db' => "CONCAT(first_name, ' ', last_name)",
- 'width' => 35,
- ),
-
- 'date_birth' =>array('label' => 'Birth date',
- 'width' => 20,
- 'searchoptions' => array('dataInit' => $this->initDatepicker(array(
- 'dateFormat' => 'yy-mm-dd',
- 'changeMonth' => true,
- 'changeYear' => true,
- 'minDate' => '1950-01-01',
- 'maxDate' => '2000-01-01',
- 'onSelect' => new jqGrid_Data_Raw('function(){$grid[0].triggerToolbar();}'),
- ))),
- 'search_op' => 'equal',
- ),
-
- 'date_register' =>array('label' => 'Register date',
- 'width' => 20,
- 'searchoptions' => array('dataInit' => $this->initDateRangePicker(array(
- 'earliestDate' => '2011-01-01',
- 'latestDate' => '2011-06-10',
- 'dateFormat' => 'yy-mm-dd',
- 'onChange' => new jqGrid_Data_Raw('dateRangePicker_onChange'),
- 'presetRanges' => array(
- array('text' => 'January 2011', 'dateStart' => '2011-01-01', 'dateEnd' => '2011-02-01'),
- array('text' => 'February 2011', 'dateStart' => '2011-02-01', 'dateEnd' => '2011-03-01'),
- ),
- 'datepickerOptions' => array(
- 'changeMonth' => true,
- 'dateFormat' => 'yy-mm-dd',
- 'minDate' => '2011-01-01',
- 'maxDate' => '2011-06-10',
- ),
- ))),
- 'search_op' => 'date_range',
- ),
- );
-
- $this->render_filter_toolbar = true;
- }
-
- protected function searchOpDateRange($c, $val)
- {
- //--------------
- // Date range
- //--------------
-
- if(strpos($val, ' - ') !== false)
- {
- list($start, $end) = explode(' - ', $val, 2);
-
- $start = strtotime(trim($start));
- $end = strtotime(trim($end));
-
- if(!$start or !$end)
- {
- throw new jqGrid_Exception('Invalid date format');
- }
-
- #Stap dates if start is bigger than end
- if($start > $end)
- {
- list($start, $end) = array($end, $start);
- }
-
- $start = date('Y-m-d', $start);
- $end = date('Y-m-d', $end);
-
- return $c['db'] . " BETWEEN '$start' AND '$end'";
- }
-
- //------------
- // Single date
- //------------
-
- $val = strtotime(trim($val));
-
- if(!$val)
- {
- throw new jqGrid_Exception('Invalid date format');
- }
-
- $val = date('Y-m-d', $val);
-
- return "DATE({$c['db']}) = '$val'";
- }
-
- protected function initDatepicker($options=null)
- {
- $options = is_array($options) ? $options : array();
-
- return new jqGrid_Data_Raw('function(el){$(el).datepicker(' . jqGrid_Utils::jsonEncode($options) . ');}');
- }
-
- protected function initDateRangePicker($options=null)
- {
- $options = is_array($options) ? $options : array();
-
- return new jqGrid_Data_Raw('function(el){$(el).daterangepicker(' . jqGrid_Utils::jsonEncode($options) . ');}');
- }
+ protected function init()
+ {
+ $this->table = 'tbl_customer';
+
+ #Set columns
+ $this->cols = array(
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ ),
+
+ 'c_name' => array('label' => 'Customer name',
+ 'db' => "CONCAT(first_name, ' ', last_name)",
+ 'width' => 35,
+ ),
+
+ 'date_birth' => array('label' => 'Birth date',
+ 'width' => 20,
+ 'searchoptions' => array('dataInit' => $this->initDatepicker(array(
+ 'dateFormat' => 'yy-mm-dd',
+ 'changeMonth' => true,
+ 'changeYear' => true,
+ 'minDate' => '1950-01-01',
+ 'maxDate' => '2000-01-01',
+ 'onSelect' => new jqGrid_Data_Raw('function(){$grid[0].triggerToolbar();}'),
+ ))),
+ 'search_op' => 'equal',
+ ),
+
+ 'date_register' => array('label' => 'Register date',
+ 'width' => 20,
+ 'searchoptions' => array('dataInit' => $this->initDateRangePicker(array(
+ 'earliestDate' => '2011-01-01',
+ 'latestDate' => '2011-06-10',
+ 'dateFormat' => 'yy-mm-dd',
+ 'onChange' => new jqGrid_Data_Raw('dateRangePicker_onChange'),
+ 'presetRanges' => array(
+ array('text' => 'January 2011', 'dateStart' => '2011-01-01', 'dateEnd' => '2011-02-01'),
+ array('text' => 'February 2011', 'dateStart' => '2011-02-01', 'dateEnd' => '2011-03-01'),
+ ),
+ 'datepickerOptions' => array(
+ 'changeMonth' => true,
+ 'dateFormat' => 'yy-mm-dd',
+ 'minDate' => '2011-01-01',
+ 'maxDate' => '2011-06-10',
+ ),
+ ))),
+ 'search_op' => 'date_range',
+ ),
+ );
+
+ $this->render_filter_toolbar = true;
+ }
+
+ protected function searchOpDateRange($c, $val)
+ {
+ //--------------
+ // Date range
+ //--------------
+
+ if(strpos($val, ' - ') !== false)
+ {
+ list($start, $end) = explode(' - ', $val, 2);
+
+ $start = strtotime(trim($start));
+ $end = strtotime(trim($end));
+
+ if(!$start or !$end)
+ {
+ throw new jqGrid_Exception('Invalid date format');
+ }
+
+ #Stap dates if start is bigger than end
+ if($start > $end)
+ {
+ list($start, $end) = array($end, $start);
+ }
+
+ $start = date('Y-m-d', $start);
+ $end = date('Y-m-d', $end);
+
+ return $c['db'] . " BETWEEN '$start' AND '$end'";
+ }
+
+ //------------
+ // Single date
+ //------------
+
+ $val = strtotime(trim($val));
+
+ if(!$val)
+ {
+ throw new jqGrid_Exception('Invalid date format');
+ }
+
+ $val = date('Y-m-d', $val);
+
+ return "DATE({$c['db']}) = '$val'";
+ }
+
+ protected function initDatepicker($options = null)
+ {
+ $options = is_array($options) ? $options : array();
+
+ return new jqGrid_Data_Raw('function(el){$(el).datepicker(' . jqGrid_Utils::jsonEncode($options) . ');}');
+ }
+
+ protected function initDateRangePicker($options = null)
+ {
+ $options = is_array($options) ? $options : array();
+
+ return new jqGrid_Data_Raw('function(el){$(el).daterangepicker(' . jqGrid_Utils::jsonEncode($options) . ');}');
+ }
}
View
114 examples/grids/jqMiscGroupHeader.php
@@ -2,13 +2,13 @@
class jqMiscGroupHeader extends jqGrid
{
- protected function init()
- {
- $this->options = array('caption' => 'Group Headers');
-
- $this->table = 'tbl_order_item';
-
- $this->query = "
+ protected function init()
+ {
+ $this->options = array('caption' => 'Group Headers');
+
+ $this->table = 'tbl_order_item';
+
+ $this->query = "
SELECT {fields}
FROM tbl_books b
JOIN tbl_order_item i ON (b.id=i.book_id)
@@ -17,55 +17,55 @@ protected function init()
WHERE {where}
";
- $this->cols_default = array('align' => 'center', 'width' => 10);
+ $this->cols_default = array('align' => 'center', 'width' => 10);
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'db' => 'i.id',
+ 'width' => 7,
+ ),
+
+ 'book_name' => array('label' => 'Book name',
+ 'db' => 'b.name',
+ 'width' => 30,
+ 'align' => 'left',
+ ),
+
+ 'orig_price' => array('label' => 'Orig price',
+ 'db' => 'b.price',
+ 'formatter' => 'integer',
+ ),
+
+ 'order_price' => array('label' => 'Price',
+ 'db' => 'i.price',
+ 'formatter' => 'integer',
+ ),
+
+ 'quantity' => array('label' => 'Quantity',
+ 'db' => 'i.quantity',
+ ),
+
+ 'sum' => array('label' => 'Sum',
+ 'db' => 'i.price * i.quantity',
+ ),
+
+ 'customer_name' => array('label' => 'Customer name',
+ 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
+ 'width' => 18,
+ 'align' => 'left',
+ ),
+
+ 'date_birth' => array('label' => 'Birthdate',
+ 'db' => 'c.date_birth',
+ 'formatter' => 'date',
+ ),
+
+ 'random' => array('label' => 'Random',
+ 'db' => 'CEIL(RAND() * 100)',
+ ),
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'db' => 'i.id',
- 'width' => 7,
- ),
-
- 'book_name' =>array('label' => 'Book name',
- 'db' => 'b.name',
- 'width' => 30,
- 'align' => 'left',
- ),
-
- 'orig_price' =>array('label' => 'Orig price',
- 'db' => 'b.price',
- 'formatter' => 'integer',
- ),
-
- 'order_price' =>array('label' => 'Price',
- 'db' => 'i.price',
- 'formatter' => 'integer',
- ),
-
- 'quantity' =>array('label' => 'Quantity',
- 'db' => 'i.quantity',
- ),
-
- 'sum' =>array('label' => 'Sum',
- 'db' => 'i.price * i.quantity',
- ),
-
- 'customer_name' =>array('label' => 'Customer name',
- 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
- 'width' => 18,
- 'align' => 'left',
- ),
-
- 'date_birth' =>array('label' => 'Birthdate',
- 'db' => 'c.date_birth',
- 'formatter' => 'date',
- ),
-
- 'random' =>array('label' => 'Random',
- 'db' => 'CEIL(RAND() * 100)',
- ),
-
- );
- }
+ );
+ }
}
View
128 examples/grids/jqMiscGroupHeaderEx.php
@@ -2,13 +2,13 @@
class jqMiscGroupHeaderEx extends jqGrid
{
- protected function init()
- {
- $this->options = array('caption' => 'Group Headers');
-
- $this->table = 'tbl_order_item';
-
- $this->query = "
+ protected function init()
+ {
+ $this->options = array('caption' => 'Group Headers');
+
+ $this->table = 'tbl_order_item';
+
+ $this->query = "
SELECT {fields}
FROM tbl_books b
JOIN tbl_order_item i ON (b.id=i.book_id)
@@ -17,62 +17,62 @@ protected function init()
WHERE {where}
";
- $this->cols_default = array('align' => 'center', 'width' => 10);
+ $this->cols_default = array('align' => 'center', 'width' => 10);
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'db' => 'i.id',
+ 'width' => 7,
+ ),
+
+ 'book_name' => array('label' => 'Book name',
+ 'db' => 'b.name',
+ 'width' => 30,
+ 'align' => 'left',
+ 'hgroup' => 'book',
+ ),
+
+ 'orig_price' => array('label' => 'Orig price',
+ 'db' => 'b.price',
+ 'formatter' => 'integer',
+ 'hgroup' => 'book',
+ ),
+
+ 'order_price' => array('label' => 'Price',
+ 'db' => 'i.price',
+ 'formatter' => 'integer',
+ 'hgroup' => 'order',
+ ),
+
+ 'quantity' => array('label' => 'Quantity',
+ 'db' => 'i.quantity',
+ 'hgroup' => 'order',
+ ),
+
+ 'sum' => array('label' => 'Sum',
+ 'db' => 'i.price * i.quantity',
+ 'hgroup' => 'order',
+ ),
+
+ 'customer_name' => array('label' => 'Customer name',
+ 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
+ 'width' => 18,
+ 'align' => 'left',
+ 'hgroup' => 'customer',
+ ),
+
+ 'date_birth' => array('label' => 'Birthdate',
+ 'db' => 'c.date_birth',
+ 'formatter' => 'date',
+ 'hgroup' => 'customer',
+ ),
+
+ 'random' => array('label' => 'Random',
+ 'db' => 'CEIL(RAND() * 100)',
+ ),
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'db' => 'i.id',
- 'width' => 7,
- ),
-
- 'book_name' =>array('label' => 'Book name',
- 'db' => 'b.name',
- 'width' => 30,
- 'align' => 'left',
- 'hgroup'=> 'book',
- ),
-
- 'orig_price' =>array('label' => 'Orig price',
- 'db' => 'b.price',
- 'formatter' => 'integer',
- 'hgroup'=> 'book',
- ),
-
- 'order_price' =>array('label' => 'Price',
- 'db' => 'i.price',
- 'formatter' => 'integer',
- 'hgroup'=> 'order',
- ),
-
- 'quantity' =>array('label' => 'Quantity',
- 'db' => 'i.quantity',
- 'hgroup'=> 'order',
- ),
-
- 'sum' =>array('label' => 'Sum',
- 'db' => 'i.price * i.quantity',
- 'hgroup'=> 'order',
- ),
-
- 'customer_name' =>array('label' => 'Customer name',
- 'db' => "CONCAT(c.first_name, ' ', c.last_name)",
- 'width' => 18,
- 'align' => 'left',
- 'hgroup'=> 'customer',
- ),
-
- 'date_birth' =>array('label' => 'Birthdate',
- 'db' => 'c.date_birth',
- 'formatter' => 'date',
- 'hgroup'=> 'customer',
- ),
-
- 'random' =>array('label' => 'Random',
- 'db' => 'CEIL(RAND() * 100)',
- ),
-
- );
- }
+ );
+ }
}
View
102 examples/grids/jqMiscSubgrid.php
@@ -2,55 +2,55 @@
class jqMiscSubgrid extends jqGrid
{
- protected function init()
- {
- #Set database table
- $this->table = 'tbl_customer';
-
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'width' => 10,
- 'align' => 'center',
- ),
-
- 'first_name'=>array('label' => 'First name',
- 'width' => 35,
- 'editable' => true,
- ),
-
- 'last_name' =>array('label' => 'Last name',
- 'width' => 35,
- 'editable' => true,
- ),
-
- 'email' =>array('label' => 'Email',
- 'width' => 30,
- 'editable' => true,
- ),
-
- 'phone' =>array('label' => 'Phone',
- 'width' => 25,
- 'align' => 'center',
- ),
-
- 'discount' =>array('label' => 'Discount',
- 'width' => 15,
- 'formatter' => 'numeric',
- 'align' => 'center',
- ),
- );
- }
-
- protected function opRenderSubgrid()
- {
- echo $this->loader->render('jqMiscSubgrid2', array('customer_id' => $this->input('customer_id')));
- exit;
- }
-
- protected function opEdit($id, $upd)
- {
- return true;
- }
+ protected function init()
+ {
+ #Set database table
+ $this->table = 'tbl_customer';
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'width' => 10,
+ 'align' => 'center',
+ ),
+
+ 'first_name' => array('label' => 'First name',
+ 'width' => 35,
+ 'editable' => true,
+ ),
+
+ 'last_name' => array('label' => 'Last name',
+ 'width' => 35,
+ 'editable' => true,
+ ),
+
+ 'email' => array('label' => 'Email',
+ 'width' => 30,
+ 'editable' => true,
+ ),
+
+ 'phone' => array('label' => 'Phone',
+ 'width' => 25,
+ 'align' => 'center',
+ ),
+
+ 'discount' => array('label' => 'Discount',
+ 'width' => 15,
+ 'formatter' => 'numeric',
+ 'align' => 'center',
+ ),
+ );
+ }
+
+ protected function opRenderSubgrid()
+ {
+ echo $this->Loader->render('jqMiscSubgrid2', array('customer_id' => $this->input('customer_id')));
+ exit;
+ }
+
+ protected function opEdit($id, $upd)
+ {
+ return true;
+ }
}
View
102 examples/grids/jqMiscSubgrid2.php
@@ -2,62 +2,62 @@
class jqMiscSubgrid2 extends jqGrid
{
- protected function init()
- {
- $this->options = array('rowNum' => 5, 'width' => 600, 'height' => 110);
- $this->render_extend = '{}';
+ protected function init()
+ {
+ $this->options = array('rowNum' => 5, 'width' => 600, 'height' => 110);
+ $this->render_extend = '{}';
$this->render_suffix_col = 'customer_id';
-
- #Set database table
- $this->table = 'tbl_order_item';
-
- $this->query = "
+
+ #Set database table
+ $this->table = 'tbl_order_item';
+
+ $this->query = "
SELECT {fields}
FROM tbl_order_item oi
JOIN tbl_order o ON (oi.order_id=o.id)
JOIN tbl_books b ON (oi.book_id=b.id)
WHERE {where}
";
-
- $this->cols_default = array('align' => 'center');
-
- #Set columns
- $this->cols = array(
-
- 'id' =>array('label' => 'ID',
- 'db' => 'oi.id',
- 'hidden'=> true,
- ),
-
- 'book_id' =>array('label' => 'Book ID',
- 'db' => 'oi.book_id',
- 'width' => 10,
- ),
-
- 'book_name' =>array('label' => 'Book name',
- 'db' => 'b.name',
- 'width' => 40,
- 'align' => 'left',
- ),
-
- 'price' =>array('label' => 'Price',
- 'db' => 'oi.price',
- 'width' => 15,
- ),
-
- 'quantity' =>array('label' => 'quantity',
- 'db' => 'oi.quantity',
- 'width' => 12,
- ),
- );
-
- #Set essential condition
- $this->where[] = 'o.customer_id = ' . intval($this->input['customer_id']);
- }
-
- #prevent common html rendering
- protected function renderHtml($data)
- {
- return '';
- }
+
+ $this->cols_default = array('align' => 'center');
+
+ #Set columns
+ $this->cols = array(
+
+ 'id' => array('label' => 'ID',
+ 'db' => 'oi.id',
+ 'hidden' => true,
+ ),
+
+ 'book_id' => array('label' => 'Book ID',
+ 'db' => 'oi.book_id',
+ 'width' => 10,
+ ),
+
+ 'book_name' => array('label' => 'Book name',
+ 'db' => 'b.name',
+ 'width' => 40,
+ 'align' => 'left',
+ ),
+
+ 'price' => array('label' => 'Price',
+ 'db' => 'oi.price',
+ 'width' => 15,
+ ),
+
+ 'quantity' => array('label' => 'quantity',
+ 'db' => 'oi.quantity',
+ 'width' => 12,
+ ),
+ );
+
+ #Set essential condition
+ $this->where[] = 'o.customer_id = ' . intval($this->input['customer_id']);
+ }
+
+ #prevent common html rendering
+ protected function renderHtml($data)
+ {
+ return '';
+ }
}
View
64 examples/grids/jqMssql.php
@@ -1,33 +1,33 @@
-<?php
-
-class jqMssql extends jqGrid_Adapter_Mssql
-{
- public function __construct($loader)
- {
- $loader->set('pdo_dsn', "sqlsrv:Server=localhost\SQLEXPRESS;Database=new_db");
- $loader->set('pdo_user', null);
- $loader->set('pdo_pass', null);
-
- /*
- $loader->set('db_driver', 'mssql');
- $loader->set('db_host', 'localhost');
- $loader->set('db_user', null);
- $loader->set('db_pass', null);
- $loader->set('db_name', 'test');
- */
-
- parent::__construct($loader);
- }
-
- protected function init()
- {
- $this->options = array('rowNum' => 5);
-
- $this->table = 'test';
-
- $this->cols = array(
- 'id' =>array('width' => 10),
- 'name' =>array('width' => 40),
- );
- }
+<?php
+
+class jqMssql extends jqGrid_Adapter_Mssql
+{
+ public function __construct($loader)
+ {
+ $loader->set('pdo_dsn', "sqlsrv:Server=localhost\SQLEXPRESS;Database=new_db");
+ $loader->set('pdo_user', null);
+ $loader->set('pdo_pass', null);
+
+ /*
+ $loader->set('db_driver', 'mssql');
+ $loader->set('db_host', 'localhost');
+ $loader->set('db_user', null);
+ $loader->set('db_pass', null);
+ $loader->set('db_name', 'test');
+ */
+
+ parent::__construct($loader);
+ }
+
+ protected function init()
+ {
+ $this->options = array('rowNum' => 5);
+
+ $this->table =