Advertisement
GWibisono

popup

Oct 27th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.98 KB | None | 0 0
  1. <link rel="stylesheet" type="text/css" media="screen" href="themes/cupertino/jquery-ui-1.10.3.custom.min.css" />
  2. <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
  3. <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" />
  4. <style>
  5. .centerTable{
  6.     width:600px;
  7.     margin:50px auto 0;
  8.  
  9. }
  10. .hide {
  11.      display:none;
  12.     position:absolute;
  13.     top:30px;
  14.     background:#5c9ccc;
  15.     padding:1px;
  16.     z-index:200;
  17.     /*
  18.     border-radius: 15px 15px 0 0;
  19.     */
  20.     width:600px;
  21.     margin:10px auto;
  22. }
  23. .hide2 {
  24.    z-index:201;
  25.     padding:10px 0px 0 0px;
  26. }
  27. .head2{
  28.     margin:0  ;
  29.     padding:0 30px 5px;
  30.     color:white;
  31. }
  32.  
  33. .msg{
  34. display:none;
  35. }
  36. .hide3 {
  37.     display:none;
  38.     position:fixed;
  39.     top:0;
  40.     left:0;
  41.     z-index:100;
  42.     opacity:0.5;
  43.     filter:alpha(opacity=80);
  44.     /* For IE8 and earlier */
  45.     background:gray;
  46. }
  47. li.dua {
  48.     margin:30px 20px;
  49. }
  50. .one {
  51.      
  52.     margin:auto;
  53.     padding:10px 30px;
  54.     background:white;
  55. }
  56. .two{
  57.     vertical-align: top;
  58.     padding: 11px 25px 0;
  59.     width: 120px;
  60.     float: left;
  61.     height: 50px;
  62. }
  63. .two div{
  64. vertical-align:top;
  65. padding: 0  ;
  66. min-width:30px;
  67. float:left;
  68. }
  69. .three{
  70.     text-align:top;
  71.     padding:0px 50px 10px 0;
  72.     width:40px;
  73.     float:right;
  74.     height:50px;
  75. }
  76. .four{
  77. background:#dfeffc;
  78. padding: 5px 6px 0;
  79. margin:0 0 1px 0;
  80.  
  81. }
  82.  
  83. .clear{
  84. clear:both;
  85. }
  86. .block {
  87.     float:left;
  88.     padding-bottom:15px;
  89.     width:150px;
  90. }
  91. .block div{
  92.      float:left;
  93. }
  94. .block .txt{
  95.  
  96. }
  97.  
  98.  
  99. /*Splitter style */
  100. input{
  101.  
  102. }
  103.  
  104. #LeftPane {
  105.     /* optional, initial splitbar position */
  106.     overflow: auto;
  107. }
  108. /*
  109.  * Right-side element of the splitter.
  110. */
  111.  
  112. #RightPane {
  113.     padding: 2px;
  114.     overflow: auto;
  115. }
  116. .ui-tabs-nav li {position: relative;}
  117. .ui-tabs-selected a span {padding-right: 10px;}
  118. .ui-tabs-close {display: none;position: absolute;top: 3px;right: 0px;z-index: 800;width: 16px;height: 14px;font-size: 10px; font-style: normal;cursor: pointer;}
  119. .ui-tabs-selected .ui-tabs-close {display: block;}
  120. .ui-layout-west .ui-jqgrid tr.jqgrow td { border-bottom: 0px none;}
  121. .ui-datepicker {z-index:1200;}
  122. .rotate
  123.     {
  124.         /* for Safari */
  125.         -webkit-transform: rotate(-90deg);
  126.  
  127.         /* for Firefox */
  128.         -moz-transform: rotate(-90deg);
  129.  
  130.         /* for Internet Explorer */
  131.         filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
  132.     }
  133. #list2{
  134.     width:600px;
  135. }
  136. #pager2{
  137.     height:60px;
  138.    
  139. }
  140. </style>
  141.  
  142.  
  143. <script src="js/jquery.min.js" type="text/javascript"></script>
  144. <script src="js/jquery-ui-custom.min.js" type="text/javascript"></script>
  145. <script src="js/jquery.layout.js" type="text/javascript"></script>
  146. <script src="js/grid.locale-en.js" type="text/javascript"></script>
  147.  
  148.  
  149. <script src="js/ui.multiselect.js" type="text/javascript"></script>
  150. <script src="js/jquery.jqGrid.js" type="text/javascript"></script>
  151. <script src="js/jquery.tablednd.js" type="text/javascript"></script>
  152. <script src="js/jquery.contextmenu.js" type="text/javascript"></script>
  153. <div class='centerTable'>
  154.     <table id="list2"></table>
  155.     <div id="pager2" ></div>
  156. </div>
  157. <script >
  158. jQuery("#list2").jqGrid({
  159.     url:'localset.php',
  160.     datatype: "json",
  161.     height: 255,
  162.     width: 600,
  163.    colNames:['Index','Name', 'Code'],
  164.     colModel:[
  165.         {name:'item_id',index:'item_id', width:65,  sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']}},
  166.         {name:'item',index:'item', width:150, sorttype:'string', searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
  167.         {name:'item_cd',index:'item_cd', width:200}    
  168.     ],
  169.     rowNum:20,
  170.     rowTotal: 200,
  171.     rowList:[20,30,50],
  172.     loadonce:true,
  173.     mtype: "GET",
  174.     rownumbers: true,
  175.     rownumWidth: 40,
  176.     gridview: true,
  177.     pager: '#pager2',
  178.     sortname: 'id',
  179.     viewrecords: true,
  180.     sortorder: "desc",
  181.     caption:"JSON Example"
  182. });
  183. jQuery("#list2").jqGrid('filterToolbar',{searchOperators : true});
  184. jQuery("#gs_item").bind("click", function()
  185. {
  186. show("#gs_item");
  187. });
  188. /*
  189. my function
  190. */
  191. var active="#gs_item";
  192. function show(t) {
  193.     active=t;
  194.  
  195.     var $this = $(t);
  196.     var shide = $(".hide3");
  197.     h=window.innerHeight; w=$(window).width()
  198.     if(h<600) h=640;
  199.     if(w<1000) w=1024;
  200.     shide.width(w);
  201.     shide.height(h);
  202.     //$(window).height()
  203.     shide.show();
  204.    
  205.  
  206.     var shide = $(".hide");
  207.     shide.css('display', 'none');
  208.     //log('anda menekan');
  209.  
  210.     pos = $this.position();
  211.     //log("left:" + pos.left + ";top:" + pos.top);
  212.     top = pos.top;
  213.     ////log('top:=' + top);
  214.     offset = $this.offset();
  215.     //log("left: " + offset.left + "," + offset.top);
  216.     divThis = $this.parent();
  217.     n1 = divThis.height()-10;
  218.     //log(n1);
  219.  
  220.     posLeft=Math.ceil(  offset.left) ;//($(window).width() - /2
  221.     shide.css('top', offset.top + n1);
  222.     shide.css('left', posLeft );
  223.     w=$(window).width() - posLeft -100;
  224.     shide.css('width',w);
  225.     shide.show();
  226.     //log('tampil');
  227. }
  228.  
  229. function hideAll() {
  230.     var shide = $(".hide3");
  231.     shide.css('display', 'none');
  232.     var shide = $(".hide");
  233.     shide.css('display', 'none');
  234. }
  235.  
  236. function cariData() {
  237.     var i = 0;
  238.     var ar = new Array();
  239.     //log('start cari data');
  240.     $(".cat").each(function () {
  241.  
  242.         if ($(this).is(':checked')) {
  243.  
  244.             ar[i] = $(this).val();
  245.             i++;
  246.         }
  247.     });
  248.     s = ar.join(', ');
  249.     //log(s);
  250.     //log('active='+active);
  251.     $(active).val(s);
  252. }
  253.  
  254. function log(s) {
  255.     $(".msg").append("<br>" + s);
  256.     console.log(s);
  257. }
  258.  
  259. function checkAll() {
  260.     if ($(".checkAll").is(':checked')) {
  261.         $(".cat").prop("checked", true);
  262.     } else {
  263.         $(".cat").prop("checked", false);
  264.     }
  265.     $(".checkNone").prop("checked", false);
  266.     cariData();
  267. }
  268.  
  269. function checkNone() {
  270.  
  271.     $(".checkAll").prop("checked", false);
  272.     $(".cat").prop("checked", false);
  273.     $(".checkNone").prop("checked", false);
  274.     cariData();
  275. }
  276. $(function () {
  277.     $(".cat").change(function () {
  278.         cariData();
  279.         $(".checkAll").prop("checked", false);
  280.     });
  281.     $(".button").button();
  282. });
  283. </script>
  284.  
  285. <div class='msg'>
  286.  
  287. </div>
  288. <div class='hide'>
  289.     <div class='hide2'>
  290.     <h2 class='head2'>Category</h2>
  291.     <div class='four'>
  292.         <div class='two'>
  293.              <div> <input type=checkbox onclick='checkAll();' class='checkAll' /> </div>
  294.             <div>Select All</div>
  295.         </div>
  296.         <div class='two'>
  297.             <div> <input type=checkbox onclick='checkNone();' class='checkNone' /> </div>
  298.             <div >Select None</div>
  299.         </div>
  300.         <div class='three'>
  301.             <a href="#"onclick='hideAll();'  class='button' >apply</a>
  302.         </div>
  303.         <br class='clear' />
  304.     </div>
  305.         <div class='one'>
  306. <?php
  307. $aBuah=array(
  308. 'Apel',
  309. 'Jeruk',
  310. 'Rambutan',
  311. 'Durian',
  312. 'Anggur'
  313.  
  314. );
  315. for($i=1;$i<count($aBuah);$i++)
  316. {?>    
  317.             <div class='block'>
  318.                 <div><input type=checkbox value='<?=$aBuah[$i];?>' class='cat' /></div>
  319.                 <div class='txt'><?=$aBuah[$i];?></div>
  320.             </div>
  321. <?php
  322. }
  323. ?>            
  324.             <div style='clear:both'></div>
  325.         </div>
  326.     </div>
  327. </div><div class='hide3' onclick='hideAll()'></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement