Advertisement
Guest User

Untitled

a guest
May 25th, 2010
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.38 KB | None | 0 0
  1. <?php
  2. $cs = Yii::app()->clientScript;
  3.  
  4. $cs->registerCssFile(Yii::app()->request->baseUrl.'/css/jqgrid/ui-lightness/jquery-ui.css');
  5. $cs->registerCssFile(Yii::app()->request->baseUrl.'/css/jqgrid/ui.jqgrid.css');
  6.  
  7. $cs->registerScriptFile(Yii::app()->request->baseUrl.'/js/jqgrid/jquery-1.4.2.min.js');
  8. $cs->registerScriptFile(Yii::app()->request->baseUrl.'/js/jqgrid/i18n/grid.locale-ru.js');
  9. $cs->registerScriptFile(Yii::app()->request->baseUrl.'/js/jqgrid/jquery.jqGrid.min.js');
  10.  
  11. ?>
  12.  
  13. <table id="list"></table>
  14. <div id="pager"></div>
  15.  
  16. <script type="text/javascript">
  17. $(document).ready(function(){
  18.     var lastSel;
  19.     jQuery("#list").jqGrid( {
  20.         url : '<?php echo $this->createUrl('manage/getusers'); ?>',
  21.         datatype : 'json',
  22.         mtype : 'GET',
  23.         colNames : [ 'id', 'E-Mail', 'Username', 'Status' ],
  24.         colModel : [ {
  25.             name : 'id',
  26.             index : 'id',
  27.             width : 60,
  28.             searchoptions:{sopt:['eq','ne','bw','cn']}
  29.         }, {
  30.             name : 'email',
  31.             index : 'email',
  32.             width : '100%',
  33.             searchoptions:{sopt:['eq','ne','bw','cn']}
  34.         }, {
  35.             name : 'username',
  36.             index : 'username',
  37.              editable:true,
  38.              edittype: 'text',
  39.             width : 150,
  40.             align : 'right',
  41.             searchoptions:{sopt:['eq','ne','bw','cn']}
  42.         }, {
  43.             name : 'status',
  44.             index : 'status',
  45.             width : 80,
  46.             align : 'right',
  47.             searchoptions:{sopt:['eq','ne','bw','cn']}
  48.         } ],
  49.         pager : '#pager',
  50.         rowNum : 10,
  51.         rowList : [ 10, 20, 30 ],
  52.         sortname : 'id',
  53.         sortorder : 'asc',
  54.         viewrecords : true,
  55.         caption : 'Users',
  56.         width: 800,
  57.         height: "100%",
  58.         ondblClickRow: function(id) {
  59.         if (id && id != lastSel) {
  60.          jQuery("#list").restoreRow(lastSel);
  61.           jQuery("#list").editRow(id, true);
  62.           lastSel = id;
  63.         }
  64.       }
  65.        
  66.     }).navGrid('#pager',{view:false, del:false, add:false, edit:false},
  67.       {}, // default settings for edit
  68.       {}, // default settings for add
  69.       {}, // delete instead that del:false we need this
  70.       {closeOnEscape:true, multipleSearch:true, closeAfterSearch:true}, // search options
  71.       {} /* view parameters*/
  72.     );
  73. });
  74. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement