Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all 81404 articles
Browse latest View live

Paging does not work when processing on the server side

$
0
0

My datatable works fine, except for paging, it is disabled.

        $('#datatable').dataTable({
            'paging': true,
            'ordering': true,
            'info': true,
            'order': [[2, 'desc']],
            "columnDefs": [
                {"orderable": false, "targets": 6}
            ],
            "processing": true,
            "serverSide": true,
            "ajax": 'list-load.php',
            "deferRender": true
        });
        public function loadListAction(Request $request)
        {
            $strSearch = $request->query->get('search');
            $start = (int)$request->query->get('0');
            $length = (int)$request->query->get('length');
    
            $rep = $this->getDoctrine()->getRepository(Reserva::class);
    
            // Filtered results
            $bookings = $rep->findForDatatable($strSearch, $start, $length)->getQuery()->getResult();
    
            // All records
            $total = $rep->countAll();
    
            $data = [];
            
            foreach ($bookings as $b) {
    
                $data[] = [
                    $b->getAd(),
                    $b->getCl(),
                    $b->getStart(),
                    $b->getEnd(),
                    $b->getEstado(),
                    $b->getGain(),
                    'html',
                ];
            }
    
            // Array for response
            $res = [
                'recordsTotal' => $total,
                'recordsFiltered' => count($bookings),
                'data' => $data,
            ];
    
            return new JsonResponse($res);
        }

trying to select first two colums from table on select

$
0
0

So I am currently getting the first column's data which are selected from my datatable

let rows = table.rows( { selected: true } );
                var result =  table.cells( rows.nodes(), 0 ).data();
                delete result["context"];
                delete result["length"];
                delete result["selector"];
                delete result["ajax"];

But I'd like to get the first two columns of data in the table.

Group datatable by multiple colum

Invalid JSON response

$
0
0

Hello, when i use server-side processing i've got this error in a spring webservice "Invalid JSON response" my JSON response is "PD9waHAKCi8qCiAqIERhdGFUYWJsZXMgZXhhbXBsZSBzZXJ2ZXItc2lkZSBwcm9jZXNzaW5nIHNjcmlwdC4KICoKICogUGxlYXNlIG5vdGUgdGhhdCB0aGlzIHNjcmlwdCBpcyBpbnRlbnRpb25hbGx5IGV4dHJlbWVseSBzaW1wbHkgdG8gc2hvdyBob3cKICogc2VydmVyLXNpZGUgcHJvY2Vzc2luZyBjYW4gYmUgaW1wbGVtZ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EVSU19JRCcsICdkdCcgPT4gMCApLAogICAgYXJyYXkoICdkYicgPT4gJ0NQVF9MT0dJTicsICAnZHQnID0+IDEgKSwKICAgIGFycmF5KCAnZGInID0+ICdDUFRfRU1BSUwnLCAgJ2R0JyA9PiAyICksCiAgICBhcnJheSgKICAgICAgICAnZGInICAgICAgICA9PiAnRF9NT0RJRklDQVRJT04nLAogICAgICAgICdkdCcgICAgICAgID0+IDMsCiAgICAgICAgJ2Zvcm1hdHRlcicgPT4gZnVuY3Rpb24oICRkLCAkcm93ICkgewogICAgICAgICAgICByZXR1cm4gZGF0ZSggJ2pTIE0geScsIHN0cnRvdGltZSgkZCkpOwogICAgICAgIH0KICAgICksCiAgICBhcnJheSgKICAgICAgICAnZGInICAgICAgICA9PiAnQ1BUX0NSWVBURScsCiAgICAgICAgJ2R0JyAgICAgICAgPT4gNCwKICAgICAgICAnZm9ybWF0dGVyJyA9PiBmdW5jdGlvbiggJGQsICRyb3cgKSB7CiAgICAgICAgICAgIHJldHVybiBudW1iZXJfZm9ybWF0KCRkKTsKICAgICAgICB9CiAgICApLAogICAgYXJyYXkoCiAgICAgICAgJ2RiJyAgICAgICAgPT4gJ0NQVF9NT0RJRklDQVRFVVInLAogICAgICAgICdkdCcgICAgICAgID0+IDUsCiAgICAgICAgJ2Zvcm1hdHRlcicgPT4gZnVuY3Rpb24oICRkLCAkcm93ICkgewogICAgICAgICAgICByZXR1cm4gbnVtYmVyX2Zvcm1hdCgkZCk7CiAgICAgICAgfQogICAgKQopOwoKLy8gU1FMIHNlcnZlciBjb25uZWN0aW9uIGluZm9ybWF0aW9uCiRzcWxfZGV0YWlscyA9IGFycmF5KAogICAgJ3VzZXInID0+ICdncmh1bScsCiAgICAncGFzcycgPT4gJ3NwcjNpb3UnLAogICAgJ2RiJyAgID0+ICdqZWZ5dGVzdCcsCiAgICAnaG9zdCcgPT4gJ29yYWNsZTIuY3JpLnVsbToxNTIxJwopOwoKCi8qICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKgogKiBJZiB5b3UganVzdCB3YW50IHRvIHVzZSB0aGUgYmFzaWMgY29uZmlndXJhdGlvbiBmb3IgRGF0YVRhYmxlcyB3aXRoIFBIUAogKiBzZXJ2ZXItc2lkZSwgdGhlcmUgaXMgbm8gbmVlZCB0byBlZGl0IGJlbG93IHRoaXMgbGluZS4KICovCgpyZXF1aXJlKCAnc3NwLmNsYXNzLnBocCcgKTsKCmVjaG8ganNvbl9lbmNvZGUoCiAgICBTU1A6OnNpbXBsZSggJF9HRVQsICRzcWxfZGV0YWlscywgJHRhYmxlLCAkcHJpbWFyeUtleSwgJGNvbHVtbnMgKQopOwo="

When i tried without my webservice it's ok but with spring it doesn't work... any idea ?
thanks

how to change lengthMenu of 2 tables at the same time

$
0
0

Hello ,
i have two tables on the same Display with different column names . i want to change both lengthMenu at the same time .
Thanks

duplicate scrollbar in the header : datatable and scrollX

$
0
0

Hi all,

I have a datatable with scrollX option so i have a scrollbar in the bottom of my table.
I am looking for a solution to duplicate scrollbar on the top of my table

Anybody have a solution to duplicate this scrollbar on the top ?

scroller extension / server side processing - data jumps after reloading

$
0
0

I am trying to use the scroller with server side processing, but the scroll position appears to jump every time new data is loaded.

It can be seen in the example given here https://datatables.net/extensions/scroller/examples/initialisation/server-side_processing.html

If I scroll slowly, new data records are requested when record #46 comes into view, but it scrolls back to view record #23.
If I continue scrolling slowly, every time new data is loaded it jumps either forward or backward in the table.

Is there any way I can fix this?

Datatable draw() serverside and sort, filter, search locally

$
0
0

Hello,

I am adding values in server with AJAX call and then do draw() to get all values back to datatable view.
Earlier i was using serverside:true, so that all sort, filter, search was done in server, but problem is after pulling data from server i was doing some modification in values like string concatenation and some calculation on numbers. If i do this, then sorting doesn't work correctly because it simply sort server values, not manipulated.

Then i decides to do serverside:false, my sorting problem was resolved, but when i add my values in server with AJAX and run .draw(), then values are not pulled in table because it don't fetch at all,

So i can combine this two functionality together? Is it possible or not at all?

Thank you for support,

Regards...


Any way to submit changes to just one field?

$
0
0

Is there a way in bubble edit to just submit changes to that field? I have bubble set up to individual fields. Sometimes when I change one field it updates another that I don't wont updated yet

possibility to address columns by name instead of index

$
0
0

Hi there,

it might be a stupid question, but I did not find anything about this topic in the forum.

Is there a possibility to address columns with names instead of array indices?
To make my question clearer: When I have to change the table for some reason, I would have to change all functions
containing an index - e.g.: order: [[4, 'asc']], - If I would insert a column to the front of the table at a later point, I would have to
recode all the indices. If there was a field name e.g. [[last_name, 'acs']] , the problem with recoding would not exist. So it would me much easier to maintain.

Thx,
Bernhard

Support for UIKit 3

$
0
0

Any plans to support UIKit 3 as a theme?
Been using it for months even though it's "beta" and it's a very nice framework.

I have it looking like the table options in 3 right now by CSS and jQuery
Would be great to have it official supported
Thanks

MVC + DataTables: Ajax error when loading base url. Works fine when adding home/Index to url

$
0
0

I am getting an ajax error when I try to load the base url for my MVC 5 application that uses DataTables. However, it works fine when I add Home/Index to the end of the url. How can I ensure that the base url works without throwing an ajax error?

Ajax:

            "ajax": {
                "url": "../Home/GetTaskLogList",
                "type": 'POST',
                "content-type": "application/json; charset=utf-8",
                "processData": false,
                "dataType": "json",
                "headers": "headers",
                "data": "window.JSON.stringify(obj)",
                //"headers": { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() },
                //"data": { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() },
                "traditional": true,
                "dataSrc": function (data) {
                    return JSON.parse(data);
                },
            },

Route config:

     public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

Textbox encoding

$
0
0

hello

I hope someone can help me. I have some troubles with special characters and my knowledge and the web couldn’t help me.
It look's like datatables writes/encodes not very propper:

I'm using .NET framework and MS SQLEXPRESS 2017 (SQL_Latin_General_CP850_CI_AS)

line 1 was created with datatables

line 2 was created with SQL-Query

In the header of the html file i'm using:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

and in web.config:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" />

Response:
{"draw":null,"data":[{"DT_RowId":"row_6","tooltype":"&#230;","toolname":"&#230;","modell":"&#230;","serial":"&#230;","merknad":"&#230;","arsmodell":"&#230;","lokasjon":"&#230;"}],"recordsTotal":null,"recordsFiltered":null,"error":null,"fieldErrors":[],"id":null,"meta":{},"options":{},"files":{},"upload":{"id":null},"debug":null,"cancelled":[]}

DataTable - i18n() function inside constructor

$
0
0

I defined something like that

 $.extend( true, $.fn.dataTable.defaults, {
 [...]
"language": {
      "url": contextPath + "/resources/i18n/jquery.datatable.messages_" + GLOBAL_LOCALE + ".json"
    },
[...]

When I define a dataTable how can I access i18n function inside datatable?

 var table = $('#table').DataTable({
[...]

  "columns": [
              {"data": "project.name"},
              {"data": "project.title"}, 
              {
                "data": function (row, data, index) {
                       // HERE HOW CAN I INVOKE i18n() function? this.i18n('token','default') doesn't work.            
                     }


})

Editor - Wrap editor-field in Bootstrap input-group

$
0
0

Hi All,

I would like to wrap the editor field inside a Bootstrap input-group element. I need it to show a calendar icon next to the input e.g:

<div class="input-group date">
    <div class="input-group-addon">
        <i class="fa fa-calendar"></i>
    </div>
    <div data-editor-template="TransactionDate"></div>
</div>

Unfortunately, I can't get it to display properly. Is there a way to accomplish this?

Many thanks!


Unable to load data from "json.txt"

$
0
0

<script type="text/javascript">
                $(document).ready(function(){
                   $('#testrowTable').dataTable({
                       "ajax" : "assets/data/test.txt",
                       "ajax" : { url: '/assets/json-file', dataSrc: ""},
                       "columns" : [
                           { "data" : "user_id" },
                           { "data" : "first_name" },
                           { "data" : "last_name" },
                           { "data" : "full_name" },
                           { "data" : "user_name" },
                           { "data" : "user_type" },
                           { "data" : "user_type_name" },
                           { "data" : "is_active" },
                       ]
                   });
                });
</script>

Greetings. Hi guys.
here i attached a screenshot pic.
may someone help me why i cant load my data into the table? i

Submiting a bubble data with json

I want show total of salary when i will search for specific

Accessibility of column visibility button

$
0
0

I'm evaluating the accessibilty of DataTables for a project and I'm almost on-board, but the column visiblity menu control is an issue due to not conforming to the latest ARIA 1.1 authoring practices for menus. I want to help make your widget accessible for all users so I've listed what's done right and what needs work.

The good:
* Column visibility button utilizes the "aria-haspopup" attribute to indicate that a menu is attached.
* Menu container has the appropriate "menu" role.
* Keyboard focus returns to the column visibility button when closing menu with Esc key.

The bad:
* Column visibility button is missing the "aria-expanded" attribute.
* Menu item buttons are missing the role="menuitem" attribute.
* Menu item buttons should not be placed in tab order.
* Keyboard focus not set to the first menu item/button when the menu is opened.
* Menu displayed in what visibly appears as a modal dialog, but does not have dialog structure or expected keyboard interactions which is confusing from keyboard-only user perspective.

I suggest that the DataTables dev team take a look at the code examples from the W3C and from Heydon Pickering to ensure that the all users can interact with the column visibility menu.

Keep up the great work!

Double Row Footer Summing Alternate Table Rows

$
0
0

Hi All

I have a table that shows the quantity of operatives and count of activities for different companies.

The rows of the table alternate for each company with the sum of the ops on the first row and count of activities on the second. I am looking for a solution where the footer of the table has two rows and sums the odd numbered ops rows on the top footer row and the even numbered activity table rows on the bottom.

for example first footer row sums main table rows 1, 3, 5, 7, etc and second footer row sums main table rows 2, 4, 6, 8, etc

Thanks in advance

Viewing all 81404 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>