如果索引不存在,则jqxdatatable showDetails函数自动页面切换 [英] jqxdatatable showDetails function automatic page switch if index doesn't exist

查看:144
本文介绍了如果索引不存在,则jqxdatatable showDetails函数自动页面切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jqxDataTable 插件,如果当前页面中存在行索引,我能够成功显示行详细信息,我不知道如何在行中显示行详细信息case row index在下一页或任何其他页面中,我需要一些帮助来完成这个任务请有人帮忙,请看看这个 JSFiddle

I am using jqxDataTable plugin, I could able to show row details successfully if row index exists in current page, I don't know how to show row details if in case row index is in next page or any other page, I need some help to accomplish this task please someone help, Please have a look on this JSFiddle

这是情景

每页3个创建的数据表

$("#dataTable").jqxDataTable({
  width: 632,
  source: dataAdapter,
  pageable: true,
  pageSize: 3,
  ....
  ....
  .. some more code
 });

按钮显示行详细信息

显示行详细信息的两个按钮,其中第一个按钮工作,因为行索引在当前页面中,第二个按钮没有。

Two buttons to show row details, in which first one works since row index is in current page, second button doesn't.

 // Page 1 row - no issue
 $('#jqxbutton').click(function () {
        $("#dataTable").jqxDataTable('showDetails', 0);
 });

 // Page 2 row - don't know how to switch page automatically
 $('#jqxbutton2').click(function () {
       $("#dataTable").jqxDataTable('showDetails', 5);
});

希望我的问题很清楚,如果您需要更多有关该问题的详细信息,请与我联系。

Hope my question is clear, let me know if you need more detail about the question.

谢谢。

推荐答案

如果你想去某个页面,你可以这样做: $(#dataTable)。jqxDataTable('goToPage',2); 其中 2 是页面索引。

If you are trying to go to a certain page, you can do: $("#dataTable").jqxDataTable('goToPage', 2); where 2 is the page index.

因此,对于另一页上项目的 showDetails ,您可以:

So, to showDetails of an item on another page, you can do:

$('#jqxbutton2').click(function () {
    var item = 6;
    var pageSize = $("#dataTable").jqxDataTable('pageSize');
    $("#dataTable").jqxDataTable('goToPage', parseInt(item/pageSize));
    $("#dataTable").jqxDataTable('showDetails', item);
});

这篇关于如果索引不存在,则jqxdatatable showDetails函数自动页面切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆