English 中文(简体)
一俟我把案文放在过滤箱中,就把jqGrid带上汽车过滤器
原标题:Getting jqGrid to auto-filter once I set the text in the filter box

我的第一个伙伴关系。 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);
   });
}
最佳回答

我假定,如果你打电话<代码>(#gs_RecipeName ).tri(改动),你将立即在“代码”之后(编号:_RecipeName )val(......)确定搜索工具栏的价值。 如果你使用<条码>查询:虚假即可。 如果你决定使用<条码>查询:真实。 http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3atoolbar_searching”rel=“nofollow”>triggerToolbar方法($>#grid_id”)[0].triggerToolbar()。

为清除搜索工具栏和更新电网,您可使用http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3atoolbar_searching”rel=“nofollow”>clearToolbar,其方式与triggerTbar 相同。

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签