asm javascript syntax error in callback bootstrap datatable

Hi,

I have to add callback function in bootstrap datatables but when I do this like below:

    asm
    if ( ! $.fn.DataTable.isDataTable( '#WebTableControl1Table' ) ) {
    $('#WebTableControl1Table').dataTable( {
        "searching": true,
        "ordering":  false,
        "sDom": '<"top"fl>t<"bottom"pi><"clear">',
        "pagingType": "simple_numbers",
        "lengthChange": true,
        "lengthMenu": [ 10, 25, 50, 75, 100 ],
        "language": {
            "url": "https://cdn.datatables.net/plug-ins/1.10.20/i18n/Polish.json"
        },
        "infoCallback": function( settings, start, end, max, total, pre ) {
          return start +" to "+ end;
        }
    } );
    }
    document.getElementById("logtable").style.display="block";
  end;

i get syntax error.

Any idea how to cope with this?

In attachment example project.

datatabletest.zip (836.6 KB)

Not sure if you can use asm as part of a function. I suggest to move the asm parts to a js file and create functions for the two parts. Then in unit1.pas call the function with Application.RunScript().
Attached the modified sample you have sent. Not sure if shows all the data, but it works to a certain extent.
Also be carefull with the word 'end' as a variable. Could be a reserved word.
I am not professional developer, so I may be wrong with my assumptions.

datatabletest.zip (847.1 KB)

I was wrong. According to the TMS Web Core manual it is possible to use assembler code as part of a pascal function. I have no idea why it doesn't work in your case. The experts may have an answer.

Yes, It should work in asm ... end block ... I think that we have to wait for support answer :slight_smile:

Now is ok ... I changed variables name in callback function
from

function( settings, start, end, max, total, pre )

to
function( lsettings, lstart, lend, lmax, ltotal, lpre )

and success :crazy_face: :crazy_face: :crazy_face: :crazy_face:

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.