我的第一个伙伴关系。 NET MVC 3 application 我利用jqGrid显示与reci有关的表格数据。 用户可以把一个或多个对应办法联系起来。
当我选择一个电网中一个电网时,在另一个<条码>div中显示该等离子体的详细程度,包括相关的对应物名称。
如果我强调/拷贝,一个相关的“元件一”的名称可将其贴入“回收名称”的过滤箱子中,并将过滤到该对应器上。 我想做的是,每个相关对应体都有一个链接,然后当用户点击一个相关的对应体时,它基本上会为它们做与亮相/影像/美分。
我的每个名字都是这样:
<a size="75" class="relatedrecipe" data-recipename="@item.RecipeName">@item.RecipeName</a>
当时,我有一些 j,这样做:
$(function () {
$( .relatedrecipe ).click(function () {
$( #gs_RecipeName ).val($(this).data( recipename ));
});
}
And this will, in fact, populate that input box (with the id "gs_RecipeName") with the name of my related recipe, but it doesn t auto-filter the recipe list at that point. To get it to work, I ve got to click in the box and change the text to trigger that.
Second issue After solving the first issue, I want to clear all the existing filters that might be set (which got me to the original recipe in the first place. I do "AND" filtering and if, say, a recipe for Chocolate Pie is related to a recipe for Pecan Pie and the user had previously filtered down to the Pecan Pie by filtering on "Pecan", my filter won t display that Chocolate Pie since it doesn t have pecans in it. Make sense? I guess what I want to accomplish is the following:
- Clicks the text.
- Filters are cleared.
- Recipe name is auto-filled in appropriate filter box.
- Auto-select the filtered row (left this off originally)
在那里,至少占一半。 如果你就如何触发过滤和清除其他过滤器问题提出一些指导,那么我很想听。
<>>后续行动:
我修改了我的职能如下:
$(function () {
$( .relatedrecipe ).click(function () {
var recipe = $(this).data( recipename );
setTimeout(function () {
$("#recipegrid")[0].clearToolbar();
}, 50);
setTimeout(function () {
$( gs_RecipeName ).val(recipe);
$("#recipegrid")[0].triggerToolbar();
}, 200);
});
}
如下文所述,这确实会渗透到相关的reci。 其次,我想自动选择。 我试图在上述第二个<代码>截止日期代码>栏内添加以下内容。
var firstRowID = $( #recipegrid ).getDataIds()[0];
$( #recipegrid ).setSelection(firstRowId, true);
正如在别处提到的那样,SO作为选择行文的手段,但却不工作。
www.un.org/Depts/DGACM/index_spanish.htm 电气化的解决办法:
我修改了我的法典,并做了以下工作:
$(function () {
$( .relatedrecipe ).click(function () {
// store off the value of the related recipe I want to switch to
var recipe = $(this).data( recipename );
// clear any filters on the grid
setTimeout(function () {
$("#recipegrid")[0].clearToolbar();
// set the recipe filter to the related recipe name and trigger the filtering
setTimeout(function () {
$( #gs_RecipeName ).val(recipe);
$( #recipegrid )[0].triggerToolbar();
// auto-select the first row
setTimeout(function () {
var firstRowID = $( #recipegrid ).jqGrid( getDataIds )[0];
$( #recipegrid ).setSelection(firstRowId, true);
}, 50);
}, 50);
}, 50);
});
}