行点击上的 Flexigrid
如何以 Flexigrid 方式触发行单击操作的常见操作?我希望当单击该行时重定向到 http://localhost/view/40 (ID 的值)对于单击的行
$("#flex1").flexigrid({
url: 'http://localhost/index.php/get_data',
dataType: 'json',
method: 'GET',
colModel : [
{display: 'ID', name : 'id', width : 40, sortable : true},
{display: 'A', name : 'a', width : 40, sortable : true},
singleSelect {display: 'B', name : 'b', width : 40, sortable : true},
],
sortname: "id",
sortorder: "desc",
showTableToggleBtn: false,
resizable: false,
useRp: true,
rp: 30,
singleSelect: true,
usepager: true,
width: 'auto',
height: 100
});
How can I trigger a common action on a row click action the flexigrid way? I want when the row is clicked to redirect to http://localhost/view/40 (the value of ID) for the clicked row
$("#flex1").flexigrid({
url: 'http://localhost/index.php/get_data',
dataType: 'json',
method: 'GET',
colModel : [
{display: 'ID', name : 'id', width : 40, sortable : true},
{display: 'A', name : 'a', width : 40, sortable : true},
singleSelect {display: 'B', name : 'b', width : 40, sortable : true},
],
sortname: "id",
sortorder: "desc",
showTableToggleBtn: false,
resizable: false,
useRp: true,
rp: 30,
singleSelect: true,
usepager: true,
width: 'auto',
height: 100
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定 flexigrid 到底是如何工作的,但我使用 jqGrid,通常我所做的就是在网格之外设置这些类型的操作。这确实需要一个通用的标记命名约定,但我假设 flexigrid 必须这样做。
例如,您可以在 Firebug 中查看 HTML,看看哪些类或 id 可能会分配给 ID 列。也许它是一个像 flexigrid-row-id 或类似的类,
只需确保在网格完成/加载后分配此事件
I'm not sure exactly how flexigrid works, but I use jqGrid, and commonly what I do is to just set these type of actions outside the grid. this does require a common markup naming convention, but I'm assuming flexigrid must do this.
so for example, you can take a look at your HTML in Firebug and see what classes or id might get assigned to the column for ID. maybe its a class like flexigrid-row-id or something like that
just make sure you assign this event after your grid has completed/loaded
我就是这样做的..
我加载网格
并在加载时.. onSuccess 触发..
This is how I do it..
I load the grid
and when it loads.. onSuccess triggers..