Tableinstance accessible in developer console, howto block?

Tableinstance accessible in developer console, howto block?

hugh_grunthugh_grunt Posts: 4Questions: 2Answers: 0

Hello,

i have everything working (serverside: ajax-data over php as sql-request) but in developer console i can access the instance of the datatable and change for example the value of the search delay:

This is how i instanced it:
const ok_table = new DataTable

and this is how it can be accessed:

I need the instance though, as i show the details also by another php-request which requires the instance-reference:
ok_table.on('click', 'td.dt-control', function (e) {
let tr = e.target.closest('tr');
let row = ok_table.row(tr);
let rid = row.data().id;
let tmp = DrawDetails(rid, row);
});

I never was able to do this on any examples i found here, so how do you guys do it that i cant access it over the console?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓
    new DataTable.Api('#myTable');
    

    will get you a new API instance to the DataTable in question if you want it.

    The search delay parameter is only settable at initialisation time though. There isn't a public API to access it after initialisation (I'm not sure why it would be needed).

    Allan

  • hugh_grunthugh_grunt Posts: 4Questions: 2Answers: 0

    Ty for answer.

    No i dont think it is needed as well.

    I was just worried it represents an security issue if it is accessible.

    But i think i was wrong either way, as with that i am also able to get the api of all the examples provided here.

    So mb i wasnt doing it wrong anyway.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Everything in Javascript is accessible. If you want everything to be inaccessible to the end user, don't do it in Javascript :)

    Allan

Sign In or Register to comment.