https://stackoverflow.com/questions/8832085/jqgrid-change-filter-search-pop-up-form-to-be-flat-on-page-not-a-dialog/24528183#24528183


JQ그리드에서 서치 할때 어떻게 하면 쉽게 할 수 있을까 

테이블 내에 칼럼 서칭이나 옵션클릭을 통해 서칭을 구현하는 부분은 쉽게 가능했지만.


일반적인 서칭이 안되는 상황 아 결국 이건 전통적인 방법으로 구현해야 하나...하지만

귀차니즘으로 만들기 보다는 


서칭을 쉽게 구현  할 수 있는 방법이 있지 않을까해서

검색 했고 

찾았다.!

  


이거면 끝 

enter image description here


Employee name:
<input type="text" name="employeeName" id="employeeName" style="width:250px" />

<!--  This will be my jqGrid control and pager -->
<table id="tblEmployees"></table>
<div id="pager"></div>
$("#employeeName").on('change keyup paste', function () {
    SearchByEmployeeName();
});

function SearchByEmployeeName()
{
    //  Fetch the text from our <input> control
    var searchString = $("#employeeName").val();

    //  Prepare to pass a new search filter to our jqGrid
    var f = { groupOp: "AND", rules: [] };

    //  Remember to change the following line to reflect the jqGrid column you want to search for your string in
    //  In this example, I'm searching through the UserName column.

    f.rules.push({ field: "UserName", op: "cn", data: searchString });

    var grid = $('#tblEmployees');
    grid[0].p.search = f.rules.length > 0;
    $.extend(grid[0].p.postData, { filters: JSON.stringify(f) });
    grid.trigger("reloadGrid", [{ page: 1 }]);
}


+ Recent posts