Update datatables after insert in db. Maybe hash?

Update datatables after insert in db. Maybe hash?

progy85progy85 Posts: 3Questions: 2Answers: 0

Hello,

My datatables works very well. For Update I used ajax reload and works.

The problem is first time because I can't to get ID from webmethod.

This is my code
` /RELACIJE/
$('#Relacije').DataTable({
serverSide: false,

            ajax: {
                url: 'webservice/sluzbenapotovanja.asmx/PripeteRelacije',
                type: 'GET',
                data: { username: $.cookie("user"), password: $.cookie("pass"), IdPodjetja: localStorage.getItem("IdPodjetja"), IdNaloga: getHashValue('IdNaloga') },
                dataType: "json",
            },
            "columns": [
                { "data": "ID", "visible": false },
                { "data": "Relacija" },
                { "data": "Kilometrov" },
                { "data": "KilometrinaTujina", "visible": false },
                { "data": "OpisNamena", "visible": false },
                { "data": "DatumRelacije", "visible": false },
            ]
        });

`

Like this I retrieved data. It's ok.

Now I used hash solution but not works. If hash ID has been changed, then displays previous data. if reload page then again works.

If used this code in my ajax success works, but after that I got error reiniatilize not possible...

The answer is how can I used hash url for retrieve data after change without reloading?

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    edited January 2020

    If I understand the problem correctly you want the ajax.data to be dynamic. If thats correct then you will want to use ajax.data as a function. The docs have examples of this.

    Kevin

This discussion has been closed.