Showing posts with label DataTable. Show all posts
Showing posts with label DataTable. Show all posts

Thursday, November 26, 2020

Datatables - Keeping selected page number after callback

I save the DataTable state in the local storage to avoid passing the page number all over my app. This is how I do it:
This is very useful when you go to another page and you want to go back (using the back button) to the last selected page.
reference

Friday, March 1, 2019

Custom button in DataTable

DataTable Example:

(1)Add custom button

"buttons": [{"text": ' Custom Button',
        "action": function () {
                                alert("Custom Button Clicked");
}
        },
]


(2) Button Menu

"buttons":[
                {
                extend: 'collection',
                text: 'Menu',
                className: "menuMain",
                autoClose: true,
                buttons: [
                    {
                        text: 'Item 1',
                        action: function () {
                            alert("Item 1 Selected");
                        }
                    },
                    {
                        text: 'Item 2',
                        action: function () {
                            alert("Item 2 Selected");
                        }
                    }
                ]                           
                             },
                  ]