Laravel Datatables Dropdown Filter

Text box filters require defining the current 'Value' and the 'RecordValue' function to retrieve the filterable value from the provided record. 8, but you can start from Laravel 5. The filter dropdown would contain the following: Lead Rhythm Lead or Rhythm Bass. But I noticed when I press a key in the filter field, the list in the filtered table refresh with the right content. Data in the database is retrieved in the drop down dynamically. 1 package to read email from Gmail, Yahoo, Outlook and other email accounts. Here is the simple tips for you to display “All” option in dropdown filter like the screenshot above:. PHP & HTML Projects for $10 - $30. These all examples work great, but still, the missing piece is, there are not examples by which we can implement is a laravel service way which is yajra providing. When working with datatables. For example, you may wish to define a filter to quickly view "Admin" users within your application: # Select Filters. How to export a range of data from Excel to HTML or web page file? If you need to export a range of data as a web page (HTML file), how do you deal with it? This article will talk about ways about how to export Excel data in selection to an HTML file quickly. The most concise screencasts for the working developer, updated daily. jQuery pages load faster this is the first reason why jQuery's popularity continues to grow with. DataTables debugger. No Name Email Created at; Copyright © Tutsmake. yadcf is yet another data table column filter plugin for jQuery that integrates with jQuery DataTables Plugin to make your data tables sortable, filterable and searchable. Valid options for menuAlignment are right, left, auto, center, bottom-left, bottom-center, and bottom-right. Requirement is once user have selected a value in Product category dropdown then product dropdown should only show products for that category. Jamie Johnson September 20, 2017; updated November 1, 2017 A few months ago, I wrote an article about A DataTable with AJAX using SpryMedia's DataTables Table plug-in for jQuery. Each of our partners can help you craft a beautiful, well-architected project. VB6 provided the ItemData property for this purpose. This package is created to handle server-side works of DataTables jQuery Plugin via AJAX option by using Eloquent ORM, Fluent Query Builder or Collection. I have a drop-down for counties , msas , and zipcodes , then another drop-down with the list of states. Lorem ipsum, dolor sit amet consectetur adipisicing elit. 8, but you can start from Laravel 5. ☞ Laravel 5. jQuery Datatables Customer Search filter with Server side processing help us to get records based on our choices of data filter. NET MVC application. In this post, we will learn about custom laravel filter datatable serverside with an example. Tags: datatables, Csharp, SQL server stored procedure, asp. Beautiful reports. laravel-datatables by yajra - jQuery DataTables API for Laravel 4|5. See Creating Static Row-Level Actions. # re: jqGrid Dynamically loading select options by Renso at 8/11/2011 8:46 AM '#ajaxAllCountriesUrl' is a hidden input HTML tag that I set in my master page or any other aspx page in. There are a few different stylesheets included in the library. For learn individual column searching or filtering of DataTables data, we will add dropdown list in one of the column of DataTables and then after by using jQuery and Ajax we will filter DataTables data. MDBootstrap integration with a very popular plugin enhances the possibilities of standard tables. dataTables_filter class is for the search box. You probably know Datatables, right? It allows to quickly search and filter the table of data. A lot of time can be saved by using CRUD on repetitive tasks. Data tables are used widely in the web applications. Creating a Laravel Full CRUD with DataTables Editor. beta Server side source example. 8 Datatables Dropdown Filter Server-side using Ajax In this post, we will learn how to Search or Filter Laravel Datatables data using Ajax jQuery with Individual column searching. The most common type of Nova filter is the "select" filter, which allows the user to select a filter option from a drop-down selection menu. if you need to add custom filter like for datepicker, dropdown or specific fields of database then you can do it using laravel datatable. There's no shortage of content at Laracasts. A simple Laravel 5 and laravel 6 library that allows you to implement Repository Pattern with a single command Laravel 5. Datatables Bootstrap 4 datatables integration. css is used for twitter bootstrap v3 support and bootstrap-datepicker. Editor, like DataTables, can use nested Javascript objects, making working with multiple tables super easy. js to create a grid with pagination, sorting, filter etc. User will be able to create new filters with columns with orders and conditions. Note that this works in-combination with the global search filter! The example below shows a table which has a text input box for each column in the footer element of the table. Filters are used to narrow down the results based on particular criteria. Learn How to make Datatables Dropdown search filter at server-side in Laravel 5. The most common type of Nova filter is the "select" filter, which allows the user to select a filter option from a drop-down selection menu. Text box filters require defining the current 'Value' and the 'RecordValue' function to retrieve the filterable value from the provided record. I work with Datatables. Here is the simple tips for you to display “All” option in dropdown filter like the screenshot above:. most relationship fields) can get long and unwieldy as dropdowns once you have a lot of entries. For example, you may wish to define a filter to quickly view "Admin" users within your application: # Select Filters. I am having a jquery data table, out side which i have a dropdown list consisting of years and i want that by default datatable should be loaded and when i change year from dropdown list the datatable should change according to the year. Individual Column Filtering - Show 'All' in drop down and add a label to the filter dropdown the following code to add filtering on one column in my datatable. For instance, given the one-to-many example above where a Comment may belong to a Post or a Video, the default commentable_type would be either App\Post or App\Video, respectively. A modern REST API in Laravel 5 Part 2: Resource controls Enable consumers of your API to control and manipulate the data they request Posted by Esben Petersen on April 15, 2016. Webix TreeTable 1. The question is how can I create dropdown list for each row in order to edit data from selected dropdown list option and store to database. Query Builder Data Source. Laravel 5 datatables example from scratch Data Tables is a plug-in for the jQuery Javascript library. Here's what you will get inside. jqxDataTable with Server-side Sorting, Paging and Filtering Using JSP. In this laravel yajra datatable we will learn how to add custom field and searching data without reload the datatable. Download jsTree or use CDNJS. Nova filters allow you to scope your Nova index queries with custom conditions. ui-dropdown-trigger suppose to change the background color to green. 1 dimanche 30 avril 2017 Laravel 5. If you want to restrict the entries to a subset, you can use the methods below in your EntityCrudController's setup() method:. Dynamic dropdown in Laravel, let's say you have multiple drop downs (selects), you click on one and the contents of the other need to be dynamically changed. ConnectionStrings["ConnectionString. This article will show you how to use laravel and vuejs to build datatable without any plugin or third party library. beta DOM source with chosen example. In this Laravel tutorial, we will discuss today how to add custom filter/Search with Laravel Datatable. exports config also exist in your Laravel queue config; ensure you're using values fitting your project and hardware for: enso. In this table there is a filter on column and whenever I use the filter and select an another value from the group table the filtered table records don't refresh. Step 3: Create server. Advanced Datatables with Laravel: Five Code Examples How about if we want a custom dropdown filter that filters the Eleqouent model e. The search will then search within the filtered elements. I have managed to develop a input field which searches the generated table. Datatables is jQuery plugin for table extender, it provides the functionalities like search, sort, pagination on a table of information to handle the data more effectively. Data tables allow the users to scan, analyze, compare, filter, sort, and manipulate information to derive insights and commit actions. How to use the DataTables debugger. In the example, a drop-down changes the values of another drop-down. You can bind a DataTable to a Combobox to display one value in the ComboBox's list while using another value to identify rows. In this help topic you will learn how to bind a jqxDataTable to a MySQL database using JSP (JavaServer Pages) and implement server-side sorting, paging and filtering. if you need to add custom filter like for datepicker, dropdown or specific fields of database then you can do it using laravel datatable. these angular datatables components are open source and easy to use. DataTables allows for passing data which can. Not Laravel related, but today encountered the situation, so sharing with you. Suppose we want to add custom search filter like dropdown or specific fields of database then also you can do it by using Laravel 5. I need to know how to filter DataGrid or DataTable with the value from the. with example. In this step, I will create a PHP file "server. By default, Select2 will display the text property of each data object within the list of results. PHP & HTML Projects for $10 - $30. To avoid typing errors, I would like to use the value of a selected option item from a dropdown list. Today, We want to share with you Laravel Custom Dropdown Server Side Filter in Datatables. The question is how can I create dropdown list for each row in order to edit data from selected dropdown list option and store to database. x; Laravel 5. Note that this works in-combination with the global search filter! The example below shows a table which has a text input box for each column in the footer element of the table. Beautiful reports. In this post, we will learn about PHP Laravel DataTables example – Individual column. js is a really simple jQuery table filtering plugin which allows the visitor to filter table columns using dropdown lists. Get 36 laravel admin panel website templates on ThemeForest. You can use the "visibility" button, and the "Items per page" dropdown to manipulate what is inside the export. Creating a Laravel Full CRUD with DataTables Editor. ☞ Laravel 5. g a status field. DataTables is a jQuery JavaScript library to convert simple HTML table to dynamic feature rich table. You can add this filter type for any column of your table. AJAX calls your Laravel contoller and loads the table with data. Here you can find a complete process of Individual column searching with server side process in Laravel data tables using yajra from scratch. Example of using MvcContrib with jQuery datatable plugin. UltraDropdown is a much more powerful ValueList. Angular2 datatable for handling large and complex datasets in table format. php" and write MySQL query for each ajax request from DataTable components. A DataTable with Drop-down Select Menus - Jamie Johnson. vTextArea (Text Area): The text area that will be modified to show the current filter settings. set of tools and an application architecture that incorporates many of the best features of frameworks like CodeIgniter, Yii, ASP. To met this need the DataTables fnFilter() API function allow you to specify a column to limit to search to. Below is a list of known issues: Column filters may not work well with the extensions FixedColumns, FixedHeader, and Scroller (#34, #41, #422);. Here you can find a complete process of Individual column searching with server side process in Laravel data tables using yajra from scratch. See Creating Static Row-Level Actions. All created by our Global Community of independent Web Designers and Developers. 1)Install yajra package using cmd. You can look at Yajra\DataTables\QueryDataTable class which handles the conversion of your Query Builder into a readbale DataTable API response. beta DOM source with chosen example. g a status field. net library for a long time, as a part of our Laravel adminpanel generator QuickAdminPanel. Opening A Form Generating a Drop-Down List With an Empty Placeholder. jQuery pages load faster this is the first reason why jQuery's popularity continues to grow with. If you find the model codes little difficult to understand then you can refer to my previous tutorial for an easy code. DataTables is a jQuery library used to display the list of records in a HTML table with an intuitive interface. Laravel yajra datatables provide default global search, in that search it will. I'm working on a new song serverside datatable that reads from mysql I have about 8+ columns but we have 3 columns (Lead, Rhythm, Bass) that we want to filter via a dropdown. and LastName. The template is built with HTML, CSS, Bootstrap and Laravel versions, and also comes with authentication by default. It jQuery Plugin via AJAX option by using Eloquent ORM, Fluent Query Builder or Collection. This is an overview of what each file is to be used for: bootstrap-datepicker. Licensed under the both GPL and BSD. Advanced Datatables with Laravel: Five Code Examples How about if we want a custom dropdown filter that filters the Eleqouent model e. How would. This post will detail how to add custom filters and position them to nicely theme with your table. GridView with Server Side Filtering, Sorting and Paging in ASP. I have a drop-down for counties , msas , and zipcodes , then another drop-down with the list of states. if you need to add custom filter like for datepicker, dropdown or specific fields of database then you can do it using laravel datatable. In this example, We will implement custom multicolumn server-side filtering in jQuery dataTables. For example, this might be activating a user account in a list of users, where you simply click an Activate button. This script will list the modified filters for the current page, and how they have been modified. So the custom filter helps to make the things for you. In my Laravel application I am using Datatables to enable easy filtering etc. Additionally, if we want the same behavior with a different drop-down and a different set of options we will run into duplication of code. I have a drop-down for counties , msas , and zipcodes , then another drop-down with the list of states. Angular Datatable is a angular module for provides a datatable directive along with datatable options helpers. This package is created to handle server-side works of DataTables jQuery Plugin via AJAX option by using Eloquent ORM, Fluent Query Builder or Collection. How to integrate admin template in Laravel 5. It is important to note some slot (eg: item/body/header) will completely takes over the internal rendering of the component which will require you to re-implement functionalities such as selection and expansion. User will be able to save his filters for later. So, if I select an option of Dropdown list, Finished or Pending, this change should be stored in the database in the respective column called "Status". Drop downs allow defining all possible values, the current option, and the 'RecordValue' as before. The question is how can I create dropdown list for each row in order to edit data from selected dropdown list option and store to database. Filters in the Header. 8 application. Laravel 6 Datatables Custom Filter Example Tutorial Published September 3, 2019 by w3path In this laravel datatables tutorial, We would love to share with you how to add custom date filter and custom search box field & display data without page refresh on…. filtering data using drop-down onChange event Posted 3 years ago by sanainfotech I have a table name "domains" with column "state" type boolean value 0 or 1. In this table there is a filter on column and whenever I use the filter and select an another value from the group table the filtered table records don't refresh. Export Excel data to html files with the Save As command. jQuery Datatables Customer Search filter with Server side processing help us to get records based on our choices of data filter. Angular Datatable module help to create beautiful grid listing in your angular application using angular directive. To exemplify how to use this activity, we have created an example that reads an. Custom Query. I am very much aware that there are many packages that can be used to achieve…. The package we are going to use for Datatable is yajra/laravel-datatables-oracle. jQuery pages load faster this is the first reason why jQuery's popularity continues to grow with. The filter dropdown would contain the following: Lead Rhythm Lead or Rhythm Bass. Here's the final product (Select a filter and reload the page to test state saving):. User will be able to create new filters with columns with orders and conditions. I'm not sure it's exactly the same though. The DataTables debugger makes it easy to provide information to assist with a support request. This was something I struggled with for several hours, so I’m hoping there is some value in posting the full example. Laravel Partners are elite shops providing top-notch Laravel development and consulting. To exemplify how to use this activity, we have created an example that reads an. yadcf is yet another data table column filter plugin for jQuery that integrates with jQuery DataTables Plugin to make your data tables sortable, filterable and searchable. jQuery provides a very powerful feature which is called datatable. Like some peoples have to filter contents based on certain criteria like Status, Types or Groups. Backpack CRUD allows you to show a filters bar right above the entries table. This article will show you how to use laravel and vuejs to build datatable without any plugin or third party library. The ability to filter data using specific criteria and then present the data to a client through a UI control is an important aspect of data binding. Today, We want to share with you Laravel Datatables Individual column searching using Ajax Jquery. In this example, We will implement custom multicolumn server-side filtering in jQuery dataTables. Columns, rows. DataTables is a plug-in for the jQuery Javascript library. The most common type of Nova filter is the "select" filter, which allows the user to select a filter option from a drop-down selection menu. All code belongs to the poster and no license is enforced. Laravel Yajra datatables package provide has many functionality for searching, sorting, adding column. x; Bootstrap 4 (Optional) This package makes use of an optional default component, the Laravel Vue Pagination component created by gilbitron. Update CollectionEngine. See Creating Static Row-Level Actions. In the linked test case is there a better way to build the dropdown for the Status column, possibly even adhering to the data-order column for the sorting? It's working as desired right now but seems like a bit too much code to just build the unique select options based on data-filter attribute. It doesn't show default in datatables and we need to do with a small tips. By default, Select2 will display the text property of each data object within the list of results. You can look at Yajra\DataTables\QueryDataTable class which handles the conversion of your Query Builder into a readbale DataTable API response. During this tutorial, we will use laravel 5. When vertical (y) scrolling is enabled, DataTables will force the height of the table's viewport to the given height at all times (useful for layout). If you are building a web application, then admin panel is the most used web part. Building an example using bootstrap datatable with Laravel as server side [Laravel] Bootstrap datatable full example // No filter at first so we can assign. protected void Button1_Click(object sender, EventArgs e) { string con = ConfigurationManager. In this post, we will learn about custom laravel filter datatable serverside with an example. Like some peoples have to filter contents based on certain criteria like Status, Types or Groups. 5 is today’s leading topic. 8 Tutorial - Datatables Dropdown Filter Server-side using Ajax. In this tutorial, we will be using yajra datatable package for listing of records with pagination, sorting and filter (search) feature. Now here we will implement Datatable with Server side processing in Laravel 5. Licensed under the both GPL and BSD. Get 13 datatables PHP scripts on CodeCanyon. x; Laravel 5. "Primefaces Dropdown with Pagination & Filter "Dropdown with Filter and Pagination which sounds like component available of the shelves but not really. Yet Another DataTables Column Filter (yadcf) 0. Filtering with DataView (LINQ to DataSet) 03/30/2017; 9 minutes to read +6; In this article. php to get selected employee details from MySQL database table employee. And I try to use the dropdown filters like Status, Type, etc. Example of using MvcContrib with jQuery datatable plugin. Learn How to make Datatables Dropdown search filter at server-side in Laravel 5. We were talking about Laravel 5 on its release, we are pleased today to welcome Laravel 5. 8 and Datatables. Private Sub GetRowsByFilter() Dim table As DataTable = DataSet1. Above the table there are some dropdowns to filter results by criterion, e. net using c#, vb. A simple Laravel 5 and laravel 6 library that allows you to implement Repository Pattern with a single command Laravel 5. Not Laravel related, but today encountered the situation, so sharing with you. This sample code is associated with a white paper on this topic. 8 application using Ajax. All code belongs to the poster and no license is enforced. How to Customize Pagination. so after some research and reviewing several examples, finally I found out a way, to create a multi-column search with yajra datatables with our generator. No filter for the specified column. Filters in the Header. Sometimes it requires to add some custom search filters based on the records available like - date filtering, single field search, etc. Using the two DropDownLists and the code provided I would like to filter the data in my GridView inversed datatable (PivotTable) by the Month and Year selected. View inside the course. Laravel is a web application framework with expressive, elegant syntax. dataTable object, information about the table is read directly from the HTML page. By using this yajra Laravel Datatable package we can implement Datatable in Laravel 5. Laravel Partners are elite shops providing top-notch Laravel development and consulting. Instant PHP Platforms on DigitalOcean, Linode, and more. Each of our partners can help you craft a beautiful, well-architected project. Learn How to make Datatables Dropdown search filter at server-side in Laravel 5. A Vue component for DataTables. I have 2 Dropdowns(in text area) - Product category and Products. The data is being returned from my controller with Json. GridView: close to 25 column Filter: 4 dropdownlists Onload gridview gets binded whats the best solution for this unique situation?. How can I do stuff, just before the laravel mailable is rendered? e. Installation; Opening A Form; then you should be using Laravel anyway. php" and write MySQL query for each ajax request from DataTable components. set of tools and an application architecture that incorporates many of the best features of frameworks like CodeIgniter, Yii, ASP. The question is how can I create dropdown list for each row in order to edit data from selected dropdown list option and store to database. So the custom filter helps to make the things for you. A Usenet Indexer. JSFiddle or its authors are not responsible or liable for any loss or damage of any kind during the usage of provided code. Licensed under the both GPL and BSD. 1 or above version. I'm working on a new song serverside datatable that reads from mysql I have about 8+ columns but we have 3 columns (Lead, Rhythm, Bass) that we want to filter via a dropdown. C# Filter Datagridview | C# Controls Datagridview Filter Data - The DataGridView control is designed to be a complete solution for displaying tabular data with Windows Forms. I work with Datatables. 1)Install yajra package using cmd. View inside the course. Become a Laravel Partner. Data tables are used widely in the web applications. php" and write MySQL query for each ajax request from DataTable components. All rights reserved. I have 2 Dropdowns(in text area) - Product category and Products. 'Tour Name', 'Region', 'Dates', 'Category' etc. if you need to add custom filter like for datepicker, dropdown or specific fields of database then you can do it using laravel datatable. Either way, it appears that we don't need to lower case the filter back in FilterState. In this Laravel tutorial, we will discuss today how to add custom filter/Search with Laravel Datatable. beta DOM source with chosen example. In this tutorial, I show how you can add the custom filter to the DataTable and use it with AJAX. net In this post, we will learn how to Search or Filter Laravel Datatables data using Ajax jQuery with Individual column searching. The jQuery DataTables are very user friendly to list records with live add, edit, delete records without page refresh. Contoh kasus seperti ini, halaman web mempunyai dropdown (select option) yang jika dipilih akan menampilkan data sesuai dengan pilihan pada dropdown. This post will detail how to add custom filters and position them to nicely theme with your table. DropdownList1 has status,DropDownlist2 has date and DropDownList3 has duedate and based on these values selected i want to populate the Gridview following is my code. Advanced Datatables with Laravel: Five Code Examples How about if we want a custom dropdown filter that filters the Eleqouent model e. The filters’ state will also be saved so they’ll still be there if you reload the page. We can erase the global search box of jQuery DataTable and use our custom filter area with input fields like textbox and dropdown for implementing custom multicolumn server-side filtering in jQuery DataTables. My setup is currently using serverside processing so I'm not sure how to do this properly. php to get selected employee details from MySQL database table employee. Data tables are used widely in the web applications. timeout - this is the job timeout, so you should have an interval longer than your longest job. In this post we will show you jquery datatable dropdown column using Laravel example, hear for jquery datatable column filter - server side Laravel example we will give you demo and example for implement. All from our global community of web developers. Thanks for the example. First, we will install yajra/laravel-datatables-oracle package by writing following command in cmd. C# Filter Datagridview | C# Controls Datagridview Filter Data - The DataGridView control is designed to be a complete solution for displaying tabular data with Windows Forms. Get 13 datatables PHP scripts on CodeCanyon. So in today’s tutorial, I will show you how to integrate any admin panel easily with the Laravel. In this article, I will go over four techniques: hover effects, zebra rows, filtering, and sorting. So, we can create a search to filter data based on the bunch of options selected by the user. Data tables allow the users to scan, analyze, compare, filter, sort, and manipulate information to derive insights and commit actions. NET DataView Tutorial The DataView provides different views of the data stored in a DataTable. For more information, see the associated Building a Drop-Down Filter List for a DataGridView Column Header Cell white paper. This package helps with simple requirements of displaying data from eloquent models into data tables with ajax support. Datatables Bootstrap 4 datatables integration. This article will show you how to use laravel and vuejs to build datatable without any plugin or third party library. In this post, we will learn about PHP Laravel DataTables example – Individual column. So, if I select an option of Dropdown list, Finished or Pending, this change should be stored in the database in the respective column called "Status". Laravel Yajra datatables package provide has many functionality for searching, sorting, adding column. Laravel DataTable Server Side Processing. For example, you want to filter record as per the status and the status value is fixed such as valid, invalid, paid, unpaid or etc. It has several features including:. In this post we will show you jquery datatable dropdown column using Laravel example, hear for jquery datatable column filter – server side Laravel example we will give you demo and example for implement. Download jsTree or use CDNJS. 8 Datatable. DataTables is a jQuery JavaScript library to convert simple HTML table to dynamic feature rich table. In this PHP Tutorial, I am going to tell you how to use jQuery datatable plugin with Server-side processing with PHP and MySQL. My setup is currently using serverside processing so I'm not sure how to do this properly. In this post, we will learn about PHP Laravel DataTables example – Individual column. NET did away with the ItemData property but allows you to bind almost any type of data object to a ComboBox. First, a little backstory. If you choose to download - all the files you need are in the dist/ folder of the download. For more DataTable options, please refer to its full reference on its website. 8, but you can start from Laravel 5. DataTables example Custom filtering - range search There may be occasions when you wish to search data presented to the end user in your own manner, common examples are number range search (in between two numbers) and date range search. 1 or above version. Do you know Datatable is widely used for display data in tabular format on web page and Laravel is a widely used PHP framework for web development. The search will then search within the filtered elements. beta DOM source with chosen example. Laratables is a package by Gaurav Makhecha to handle server-side AJAX of DataTables (Table plug-in for jQuery) in Laravel +5. In my Laravel application I am using Datatables to enable easy filtering etc. make sure the queues specified in the enso. Suppose we want to add custom search filter like dropdown or specific fields of database then also you can do it by using Laravel 5. Laravel Custom Datatables filter and Search. By using this yajra Laravel Datatable package we can implement Datatable in Laravel 5. net in Bootstrap framework, my customer require me an “All” option to show all of records in table. DataTables is a most powerful and easy to use jQuery plugin for display tabular data (table listings) with support for Pagination, searching, State saving, Multi-column sorting with data type detection and lots more with ZERO or minimal configuration. Okay aarsh! maybe its my fault and I haven't made myself clear regarding the outcome I require! This is the question I asked. yadcf is yet another data table column filter plugin for jQuery that integrates with jQuery DataTables Plugin to make your data tables sortable, filterable and searchable. DataTable is an in-memory representation of structured data (like data read from a database). So, we can create a search to filter data based on the bunch of options selected by the user. But what if user then navigates away (for Edit, for example) and then wants to go back and have the same search parameters he had before? Easy. timeout - this is the job timeout, so you should have an interval longer than your longest job. Laravel Datatables Tag: jquery , laravel , laravel-4 , jquery-datatables I am trying to use server side processing for my datatable but it just doesn't work when you use the pagination. I have input boxes at the top of the headers for the search. I'm using Ajax to display data on datatable.