简体   繁体   English

使用jQuery Bootgrid方法

[英]Using jQuery Bootgrid Methods

How exactly are you meant to use the methods for jQuery BootGrid? 你究竟打算如何使用jQuery BootGrid的方法?

I've tried: 我试过了:

$("#presentation-listing-api").bootgrid('remove', [uid]);

Doesn't seem to be working? 似乎没有工作?

It's not helpful that the documentation isn't quite finished yet. 文档还没有完成,这没有用。

It should be noted, as of version [ 1.3.1 ], the " remove " feature is not supported when using the ajax option. 应该注意,从版本[ 1.3.1 ]开始,使用ajax选项时不支持“ 删除 ”功能。 There is a note in the source that reads 源中有一条注释

[ todo: implement ajax DELETE] [todo:实现ajax DELETE]

An alternative could be something like this: 替代方案可能是这样的:

$('[data-row-id="'+uid+'"]').remove();

The way to do it was kind of convoluted but I figured it out... 做到这一点的方式有点令人费解,但我想通了......

You have to mark your id column as an identifier and the type to numeric like this: 您必须将您的id列标记为标识符,并将类型标记为数字,如下所示:

<th data-column-id="id" data-identifier="true" data-type="numeric">ID</th>

Then, MAKE SURE the values in that column are unique!!! 然后,确认该列中的值是唯一的!

Then call the remove like this: 然后像这样调用删除:

rows[0] = uid;
$("#presentation-listing-api").bootgrid('remove', rows);

What I did was took the Commands demo and modified it to load just some data then worked on getting the remove to work. 我所做的是采用Commands演示并修改它以加载一些数据然后工作以使删除工作。

Here's a working fiddle: 这是一个工作小提琴:
http://jsfiddle.net/Mrbaseball34/zszc8zL6/ http://jsfiddle.net/Mrbaseball34/zszc8zL6/

Make sure you have the "id" variable as an integer in the associated object you are using to fill the table. 确保在用于填充表的关联对象中将“id”变量作为整数 With parseInt() worked even with ajax: false . 使用parseInt()甚至可以使用ajax:false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM