EVOLUTION-NINJA
Edit File: d_application_notes.php
<div class="content-wrapper"> <div class="container-fluid"> <div class="p_list"> <h3>APPLICATION NOTES</h3> <table id="list2"></table> <div id="pager2"></div> </div> </div> </div> <script> $(document).ready(function (){ jQuery("#list2").jqGrid({ url:"<?php echo site_url('controller/get_application_notes');?>", mtype : "post", datatype: "json", colNames:['Id','Document No','Document Name','Product','Application','Segment','Upload Date','Download',''], colModel:[ {name:'id',index:'id', width:50, align:'center',key:true,editable:true,hidden:true, sortable: false}, {name:'document_no',index:'document_no', width:120, align:'center',key:true,editable:true, sortable: false}, {name:'document_name',index:'document_name', width:370, align:'center',key:true,editable:true, sortable: false}, {name:'product', index:'product', align:'center',editable:true, width:70, sortable: false}, {name:'application', index:'application', align:'center',editable:true, width:120, sortable: false}, {name:'segment', index:'segment', align:'center',editable:true, width:150, sortable: false}, {name:'createdate', index:'createdate', align:'center',editable:true, width:90, sortable: false,formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'d-m-Y'}}, {name:'',index:'', search:false, width:80, align:'center',editable:false, sortable: false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; var path='<?php echo base_url();?>\''+rowObject.document+'\''; var finalpath=path.replace(/\'/g, ''); var retVal = '<a data-toggle="tooltip" title="Download" class="" target="new_blank" href="'+finalpath+'"><button>Download</button></a> '; return retVal; }}, {name:'document', index:'document', align:'center',editable:true, sortable: false, width:150,hidden:true}, ], rowNum:30, rowTotal: 2000, rowList : [30,60,90,120], toolbar: [true, "top"], rownumbers: true, rownumWidth: 40, pager:"#pager2", //sortname:'id', viewrecords: true, loadonce:true, gridview: true, //autowidth: true, sortorder:"asc", caption:"Application Notes1" }); $('#t_list2') .append($("<div><input id=\"globalSearchText\" type=\"text\"></input> <button id=\"globalSearch\" type=\"button\">Search</button></div>")); $("#globalSearchText").keypress(function (e) { var key = e.charCode || e.keyCode || 0; if (key === $.ui.keyCode.ENTER) { // 13 $("#globalSearch").click(); } }); $("#globalSearch").button({ icons: { primary: "ui-icon-search" }, text: false }).click(function () { var rules = [], i, cm, postData = $("#list2").jqGrid("getGridParam", "postData"), colModel = $("#list2").jqGrid("getGridParam", "colModel"), searchText = $("#globalSearchText").val(), l = colModel.length; for (i = 0; i < l; i++) { cm = colModel[i]; if (cm.search !== false && (cm.stype === undefined || cm.stype === "text")) { rules.push({ field: cm.name, op: "cn", data: searchText }); } } postData.filters = JSON.stringify({ groupOp: "OR", rules: rules }); $("#list2").jqGrid("setGridParam", { search: true }); $("#list2").trigger("reloadGrid", [{page: 1, current: true}]); return false; }); }); </script> <style> #globalSearchText { width: 451px; margin-top: 2px; } </style>