How to format aadata for custom html attr

How to format aadata for custom html attr

PhunnPhunn Posts: 3Questions: 2Answers: 0
edited May 2014 in DataTables

Hi,

i'm using server-side processing. How do i have to format the aadata to include my custom html attritubes
on tr and td?

<tr onlick="doRowThings()" class="even blue" style="font-size-bold;background:red;" custom="important">
   <td onclick="alert('i am a button');" class="row-button" style="font-weight:bold;">CLICK ME</td>
   <td>Peter</td>
   <td>Meyer</td>
   <td onclick="deleteRow();">Delete Row</td>
</tr>
<tr>
.
.
.
</tr>

I have absolutely no clue how to get these attribues into the aadata json string format. Can you help me?

Answers

  • PhunnPhunn Posts: 3Questions: 2Answers: 0
    edited May 2014

    It's me again! I thought of something like this json-string:

    "aaData": [
            {
                "DT_RowATTRIBUTES": {
                            "onclick":"doRowThings()",
                            "class":"even blue",
                            "style":"font-size-bold;background:red;",
                            "custom","important"
                },
                "0": {
                           "DT_CELLATTRIBUTES": {
                                       "onclick":"alert('i am a button');",
                                       "class": "row-button",
                                       "style": "font-weight:bold;"
                           },
                           "DATA": "CLICK ME"
                },
                "1": {
                            "DATA": "Peter"
                },
                "2": {
                           "DATA": "Meyer"
                },
                "3": {
                           "DT_CELLATTRIBUTES": {
                                       "onclick":"deleteRow();"
                           },
                           "DATA": "Delete Row"
                }
            },
            ...
        ]
    
This discussion has been closed.