gpt4 book ai didi

c# - JqG​​rid 搜索选项 : toolbarsearch vs standard search window

转载 作者:太空宇宙 更新时间:2023-11-03 14:21:10 25 4
gpt4 key购买 nike

我想允许用户仅使用一个 sopt 设置来过滤每一列。但是对于更高级的搜索(对于高级用户),我想让他们使用内置的搜索按钮,但我想覆盖 odata 中列出的各个列搜索选项。例如,我希望我的用户只有 ['eq'],但我希望高级用户能够从 odata 中进行选择。但搜索窗口中的搜索选项仅使用与列定义关联的选项。

 oGridtxtsopt = ['cn'];
oGriddtesopt = ['eq'];
oGridnumsopt = ['eq'];
oGridselsopt = ['eq'];
oGridFile = '@ViewBag.GridType';
oGridSortColumn = "FirstName";
oGridColNames = ['First Name', 'Last Name', 'E-mail Address', 'Date', 'Gender', 'State list', 'Rate', 'Age', 'Phone Number', ''];
oGridColModel =
[
{ name: 'FirstName', index: 'FirstName', width: 110, searchoptions: {sopt:['eq','bw']}},

{ name: 'LastName', index: 'LastName', width: 110, searchoptions: { sopt: oGridtxtsopt} },

{ name: 'EmailAddress', index: 'EmailAddress', width: 250, searchoptions: { sopt: oGridtxtsopt }, formatter: 'email' },

{ name: 'HireDate', index: 'HireDate', width: 80, align: "center", formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'm/d/Y' },
searchoptions: { sopt: oGriddtesopt, dataInit: amiDatePicker} },

{ name: 'Gender', index: 'Gender', width: 55, align: "center", stype: 'select',
searchoptions: { dataUrl: '@Url.Action("amiLookup")?' + $.param({ lookup: 'GENDER' })} },

{ name: 'State', index: 'State', width: 110, align: "center", stype: 'select',
searchoptions: { dataUrl: '@Url.Action("amiLookup")?' + $.param({ lookup: 'STATES' })} },

{ name: 'Rate', index: 'Rate', width: 45, align: "right", searchoptions: { sopt: oGridnumsopt }, formatter: 'number', formatoptions: { decimalPlaces: 2, suffix: " %"} },

{ name: 'Age', index: 'Age', width: 30, align: "center", searchoptions: { sopt: oGridnumsopt }, formatter: 'integer' },

{ name: 'Phone', index: 'Phone', width: 95, align: "center", searchoptions: { sopt: oGridtxtsopt }, formatter: amiPhoneFormatter },

{ name: 'Action', index: 'Action', width: 40, align: "center", sortable: false, search: false, formatter: amiActionFormatter }
];

oGridSearch = "endeavourSearch";
oGridName = "endeavourGrid";
oGridPager = "endeavourGridPager";

$('#' + oGridName).jqGrid
({

recordtext: oGridFile + " Found - {2}",
emptyrecords: "No " + oGridFile + " Found",
loadtext: "Searching " + oGridFile + "...",
pgtext: "Page {0} of {1}",
url: '@Url.Action("GetData")',
datatype: "json",
colNames: oGridColNames,
colModel: oGridColModel,
recreateFilter: true,
rowNum: 15,
mtype: "GET",
rowList: [15, 30, 50, 100],
pager: '#' + oGridPager,
sortname: oGridSortColumn,
sortorder: "asc",
height: "100%",
viewrecords: true,
rownumbers: false,
gridview: true,
loadonce: false,
hidegrid: false,
clearfooter: true,
caption: oGridFile + " List",
jsonReader: { repeatitems: false }

})

.filterToolbar(
{
stringResult: true, searchOnEnter: true, closeOnEscape: true
})



.navGrid('#' + oGridPager,
{
edit: false, add: false, del: false, refresh: false, search: true,
searchtitle: "Search using advanced search options",
searchtext: "Advanced Search"
},
{ }, // edit
{ }, // add
{ }, // delete
{
closeOnEscape: true,
multipleSearch: true,
closeAfterSearch: true,
closeAfterReset: true,
caption: "Endeavour Advanced Search",
Find: "Search",
Reset: "Cancel",
odata: ['equal', 'not equal', 'less', 'less or equal', 'greater', 'greater or equal', 'begins with', 'does not begin with', 'is in', 'is not in', 'ends with', 'does not end with', 'contains', 'does not contain'],
groupOps: [{ op: "AND", text: "all" }, { op: "OR", text: "any"}],
matchText: " Find",
rulesText: " matches"

}, // Search
{} // view
) ;

}

最佳答案

您应该将要在 filterToolbar 中使用的选项放在 sopt 的第一个位置(作为第一个元素)。例如,en 用于所有选择元素 (stype: 'select') 和 cnbw 用于其余 (默认 stype: 'text')。您还可以使用 filterToolbardefaultSearch 参数,如果 searchoptions 中没有定义搜索 sopt 选项,将使用该参数>.

关于c# - JqG​​rid 搜索选项 : toolbarsearch vs standard search window,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5341946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com