简体   繁体   中英

Using jQuery Bootgrid Methods

How exactly are you meant to use the methods for 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. There is a note in the source that reads

[ todo: implement 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:

<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.

Here's a working fiddle:
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. With parseInt() worked even with ajax: false .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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