0
"Buscar"버튼을 클릭하고 "teeeeeext"및 "ALTA"텍스트를 전달하여 "Buscar Index"기능을 검색 한 다음 jqGrid를 다시로드하여 결과를 표시하고 싶습니다. 매개 변수가있는 검색.jqGrid 단추로 클릭하여 텍스트 상자로 검색
내 코드 :
$("#jqGrid").jqGrid({
url: '@Url.Action("BuscarIndex")',
styleUI: 'Bootstrap',
responsive:true,
datatype: "json",
colModel: [
{ label: 'Id', name: 'Id', width: 30, key: true, hidden: true, sortable: false },
{ label: 'Clave', name: 'Clave', width: 30, sortable: false,align: 'right' },
{ label: 'Nombre', name: 'NombreCompleto', width: 150, sortable: false },
{ label: 'Perfil', name: 'Perfil.Nombre', width: 150, sortable: false },
{ label: 'Estatus', name: 'Estatus', width: 45, sortable: false,align: 'center', formatter: formatEstatus },
{ label: 'Modificar', name: '', width: 45, sortable: false, align: 'center', formatter: formatModif },
],
width: 800,
height: 250,
viewrecords: true,
rowNum: 20,
pager: "#jqGridPager"
});
public JsonResult BuscarIndex(string sidx, string sord, int page, int rows,bool _search,string searchField,string searchOper,string searchString)
{
//SEARCH
return Json(resultadoGridBT,JsonRequestBehavior.AllowGet);
}
<div class="form-group">
@Html.LabelFor(model => model.Buscar, htmlAttributes: new { @class = "control-label col-md-1" })
<div class="col-md-3">
@Html.EditorFor(model => model.Buscar, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Buscar, "", new { @class = "text-danger" })
</div>
@Html.LabelFor(model => model.Estatus, htmlAttributes: new { @class = "control-label col-md-1" })
<div class="col-md-2">
@Html.DropDownList("Estatus", null, "(TODOS)", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Estatus, "", new { @class = "text-danger" })
</div>
<button id="buscar" type="button" class="btn btn-default">Buscar</button>
</div>
<div class="col-md-12">
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
</div>
</div>
</div>
비슷한 답변을 얻으려면이 사이트의 검색 버튼을 사용하십시오. 당신은 [여기에서 시작할 수 있습니다] (https://stackoverflow.com/questions/19659248/universal-search-field-for-jqgrid) –