SHARE
TWEET

Untitled

a guest Feb 18th, 2016 29 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * PHP Grid Component
  4.  *
  5.  * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
  6.  * @version 1.5.2
  7.  * @license: see license.txt included in package
  8.  */
  9.  
  10. include_once("../../config.php");
  11.  
  12. include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
  13.  
  14. // Database config file to be passed in phpgrid constructor
  15. $db_conf = array(  
  16.                     "type"      => PHPGRID_DBTYPE,
  17.                     "server"    => PHPGRID_DBHOST,
  18.                     "user"      => PHPGRID_DBUSER,
  19.                     "password"  => PHPGRID_DBPASS,
  20.                     "database"  => PHPGRID_DBNAME
  21.                 );
  22.  
  23. $g = new jqgrid($db_conf);
  24.  
  25. $grid["caption"] = "Sample Grid";
  26. $grid["autoresize"] = true;
  27.    
  28. $g->set_options($grid);
  29.  
  30. $g->table = "clients";
  31.  
  32. $g->navgrid["param"]["refresh"] = false;
  33.  
  34. $out = $g->render("list1");
  35. ?>
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  37. <html>
  38. <head>
  39.     <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>  
  40.     <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link> 
  41.  
  42.     <script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
  43.     <script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  44.     <script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> 
  45.     <script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  46. </head>
  47. <body>
  48.     <div>
  49.     <?php echo $out?>
  50.     </div>
  51.    
  52.     <script>
  53.    
  54.     jQuery(document).ready(function(){
  55.        
  56.         jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager',
  57.         {
  58.             'caption'      : '',
  59.             'buttonicon'   : 'ui-icon-refresh',
  60.             'onClickButton': function()
  61.             {
  62.                 var myGrid = jQuery("#list1");
  63.                 // jQuery("span.s-ico",myGrid[0].grid.hDiv).hide(); // hide sort icons
  64.  
  65.                 var filters = myGrid.getGridParam("postData").filters;
  66.                 // reset filters and sort field
  67.                 myGrid.setGridParam({
  68.                             postData: { 'filters': filters }, sortname: ''
  69.                         }).trigger('reloadGrid');
  70.  
  71.                 // empty toolbar fields
  72.                 // jQuery(".ui-search-input input").val("");
  73.  
  74.             },
  75.             'position': 'last'
  76.         });
  77.     });
  78.    
  79.     </script>
  80. </body>
  81. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top