EVOLUTION-NINJA
Edit File: drive_catalogues.php
<div class="content-wrapper"> <div class="middle_work_hedding"> <div class="container-fluid"> <h3><em>Drive Manuals</em></h3> <table id="list2"></table> <div id="pager2"></div> </div> </div> </div> <script> $(document).ready(function (){ var prevCellVal = { cellId: undefined, value: undefined }; jQuery("#list2").jqGrid({ url:"<?php echo site_url('controller/catalogue_details');?>", mtype : "post", datatype: "json", colNames:['Id','Product Range','Document Type','Document Sub Type','Option Card Name','Upload Date','Download',''], colModel:[ {name:'id',index:'id', width:50, align:'center',key:true,editable:true,hidden:true, sortable: false}, {name:'product_name',index:'product_name',width:110, align:'center',editable:true, sortable: false}, // {name:'priority', index:'priority', align:'center',editable:true, width:150}, {name:'document_type', index:'document_type', align:'center',editable:true, width:150, sortable: false}, {name:'document_sub_type', index:'document_sub_type', align:'center',editable:true, width:260, sortable: false}, {name:'option_card_name', index:'option_card_name', align:'center',editable:true, width:120, sortable: false}, // {name:'id', index:'id', align:'center',editable:true, width:50}, // {name:'attachment', index:'attachment', align:'center',editable:true, width:50}, {name:'createdate', index:'createdate', align:'center',editable:true, width:100,formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'d-m-Y'}, sortable: false}, {name:'',index:'', search:false, width:100, align:'center',editable:false, sortable: false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; var path='<?php echo base_url();?>\''+rowObject.attachment+'\''; 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:'attachment', index:'attachment', align:'center',editable:true, width:150,hidden:true, sortable: false}, ], rowNum:300, rowTotal: 2000, rowList : [300,600,1200,2400], toolbar: [true, "top"], rownumbers: true, rownumWidth: 40, pager:"#pager2", // sortname:'id', viewrecords: true, hoverrows: false, loadonce:true, gridview: true, autowidth: true, //sortorder:"asc", sortable: false, caption:"Technical Manuals", grouping:true, groupingView : { groupField : ['product_name'], groupColumnShow : [true], groupText : ['<span style=font-size:17px; background-color:yellow;>{0} </span>'], groupCollapse : true, // groupOrder: ['asc'] }, }); $('#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; }); }); function hideGroupHeaders(grid) { var i, names = grid.p.groupingView.groups, l = names.length, $grp, j; for (i = 0; i < l; i++) { $grp = $('#' + grid.id + "ghead_0_" + i); if (names[i].value === '') { $grp.hide(); } } } </script> <style> #globalSearchText { width: 451px; margin-top: 2px; } #list2ghead_0_0 { font-size:17px; } </style>