datatables

sum column value using datatable

天大地大妈咪最大 提交于 2020-01-24 11:09:15
问题 I want to sum earning column values to the total at end of code. I am using Jquery datatable to filter records by this code but unable to write code for the total.I've also tried footer callback of datatable but doesn't get desired result. <script src="media/js/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="media/js/jquery.dataTables.min.js" type="text/javascript"></script> <script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>

sum column value using datatable

匆匆过客 提交于 2020-01-24 11:09:05
问题 I want to sum earning column values to the total at end of code. I am using Jquery datatable to filter records by this code but unable to write code for the total.I've also tried footer callback of datatable but doesn't get desired result. <script src="media/js/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="media/js/jquery.dataTables.min.js" type="text/javascript"></script> <script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>

jQuery DataTable ColumnFilter plugin. Can the “select” filter style support exact match?

让人想犯罪 __ 提交于 2020-01-24 01:39:08
问题 The datatable I'm creating has a "Sex" column. Here is the filter.. columnFilter({ aoColumns: [ { type: "select", values: [ 'Male', 'Female' ] }, { type: "text" }, { type: "number" }, { type: "number" }] }); The problem is that the word "male" is in the word "Female" so when I select the "Male" filter it shows all. Is there a way to have this select exact match or even at least case sensitive? 回答1: The Columnfilter plugin uses the datatables API function fnFilter to do its individual searches

How to load data into datatable using ajax in mvc

江枫思渺然 提交于 2020-01-23 12:22:16
问题 I'm loading List of objects from database into datatable using ajax. When debugging, the my MVC action result seem to query the data alright but the datatable column displays null I've tried to serialize the list before returning it in the MVC action but it didn't solve the problem // Code from View <table class="table table-striped" id="codetable"> <thead> <tr> <td>Student Number</td> <td>Student</td> <td>Faculty</td> <td>Department</td> <td>Program</td> <td>Code</td> </tr> </thead> <tbody>

Returning the first model from a hasMany relationship in Laravel

孤者浪人 提交于 2020-01-23 01:21:18
问题 Is it possible to create a quick method to return the first model from a one-to-many relationship? Here is my code, from the model file: public function books() { return $this->hasMany('App\Models\Book'); } public function first_book() { return $this->book()->first(); } This is the error I'm getting: 'Call to undefined method Illuminate\Database\Query\Builder::addEagerConstraints()' The reason I want to use this is so that I can collect the first record using the with() method, for example:

jQuery DataTables two rows in head: first row column names and sorting, second row filtering

梦想的初衷 提交于 2020-01-22 17:13:12
问题 In older versions of DataTables (up to 1.7.?), I used to be able to have a table with a two row column header, where sorting was done in the top row, and included the column name, and filtering with inputs and selects was done in the second row. <table> <thead> <tr> <th>Col 1</th> <th>Col 2</th> <th>Col 3</th> </tr> <tr> <td><input type="text" /></td> <td><select><option ....></select></td> <td><input type="text" /></td> </tr> </thead> <tbody>... With higher versions, including the latest (1

datatables server side population

非 Y 不嫁゛ 提交于 2020-01-22 02:56:31
问题 i have spend several hours trying to find how to populate the datatables with a json that comes from the backend, here is my code: <script> $(document).ready(function() { $('#dataTables-example').DataTable({ responsive: true, ajax: function (data, callback, settings) { $.ajax({ url: "classes/service.php", data: { task: "getNews", start:"1", end:"24", }, type: "POST", success:function(data){ var obj = $.parseJSON(data); var i; var divCreator =''; for (i = 0; i < obj.length; ++i) { divCreator+=

Vertically align two side by side elements to each other

寵の児 提交于 2020-01-17 12:37:06
问题 I have two elements side by side: a chart and a DataTable. The DataTable can change size from interacting with the page and the chart should change size when the window is resized. I want the shorter one to always centre itself with the taller one i.e. the current height of their containing div. I'd like it to be done in CSS only, if possible. This answer doesn't seem to work for me: CSS - vertically align two or more (side by side) elements in a div; I have the following: <div id="container"

Aggregation with django-eztables

寵の児 提交于 2020-01-17 10:59:48
问题 I'm using django-eztables to do server-side processing of a datatable. It's been working fine so far, but now I'm trying to add a field to my table that contains the total number of objects associated with the object via a particular foreign key. It's easy enough to get this to display properly on the client side using fnRender, but since sorting is done on the server side, I need to actually do the aggregation on the server side. This has been proving difficult. I can't seem to find a way to

Aggregation with django-eztables

牧云@^-^@ 提交于 2020-01-17 10:59:08
问题 I'm using django-eztables to do server-side processing of a datatable. It's been working fine so far, but now I'm trying to add a field to my table that contains the total number of objects associated with the object via a particular foreign key. It's easy enough to get this to display properly on the client side using fnRender, but since sorting is done on the server side, I need to actually do the aggregation on the server side. This has been proving difficult. I can't seem to find a way to