12

I have a dataTable in my application. I am required to add a Refresh button somewhere near Search textbox within the datatable in order to refresh the table when user clicks on it. I have figured out the refresh functionality.

The thing that I am stuck with is how do I include this button within the datatable? I want to access this button id in my end script.

Any suggestions? Also can anyone tell what is the use of bJQueryUI?

4 Answers 4

28

I simply used the following code:

$('<button id="refresh">Refresh</button>').appendTo('div.dataTables_filter');
Sign up to request clarification or add additional context in comments.

Comments

4

Here is the example page for adding buttons from datatables.net

http://datatables.net/examples/advanced_init/dom_toolbar.html

And here is the example page for sDom as mentioned by @Mike: http://datatables.net/release-datatables/examples/advanced_init/dom_multiple_elements.html

1 Comment

@SpringLearner thanks for pointing that out. I updated it with the new one.
0

I had a similar issue that I was able to solve using the sDom parameter of datatables.

http://datatables.net/forums/discussion/37/the-sdom-parameter/p1

Basically it allows you to place a div with an id within the datatable. I then used javascript to insert the button into that div.

Comments

0

You could just make a double header and use the second one for a button.

bJqueryUI allows you to use jQueryUI themes or the theme roller. So if you add the jQueryUI before you initialize datatable you could use that style instead of the default one.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.