bind data client side before render (using data passed from server)

bind data client side before render (using data passed from server)

markzzzmarkzzz Posts: 30Questions: 8Answers: 1

Hi,

i've lots of records returned from server, and some data is replicate for each row.
So, I'd like to create a dictionary server side, pass with the table "data" JSON, and bind each ID (for some field) with this dictionary.

What's the best way to do it? createdRow?
Not sure which is the value to pass to it:

dtGrid = $("#grid").DataTable({
    ajax: {
        url: "@(Url.Action("GetWorktypes", "Worktypes"))"
    },
    columns: [
        { data: "ID", title: "", visible: false, searchable: false },
        { data: "ClinicID", title: "", visible: false, searchable: false },
        { data: "MedicalID", title: "", visible: false, searchable: false },
        { data: "PatientID", title: "", visible: false, searchable: false }
    ],
    createdRow: function (row, data, dataIndex) {
        // here?
    }
});

data contains the row, and I'll return a proper patientsDictionary dictionary so I can bind PatientID with Name/Surname with dictionary...

This way doesn't works:

createdRow: function (row, data, dataIndex, patientsDictionary) {
    // dunno is correct
}

Any clues? Thanks

Replies

  • allanallan Posts: 53,082Questions: 1Answers: 8,177 Site admin

    Hi,

    Thanks for your question, but I'm not entirely sure I understand. If you want to create a server-side dictionary to do row replication, I'm not clear on why you would use anything on the client-side for it?

    Allan

Sign In or Register to comment.