Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 313
RTolton Avatar asked Sep 02 '14 10:09

RTolton


2 Answers

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();
like image 126
JimDeavers Avatar answered Sep 17 '22 22:09

JimDeavers


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/

like image 33
MB34 Avatar answered Sep 18 '22 22:09

MB34