Move to record added or edited

Move to record added or edited

bazianmbazianm Posts: 6Questions: 4Answers: 0

Hi,

I have a datatable set up as follows:

    $("#tblList").DataTable({
        "ajax": {
            "url": "/projects/ajaxTableData"
        },
        "fixedHeader": true,
        "scrollY": "200px"  ,
        "scroller": true ,
        "columns": [{"data": "cAction",             "width": "20px",    "orderable": false},
                    {"data": "iNum",                "width": "50px",    "orderable": true},
                    {"data": "cStatus",             "width": "70px",    "orderable": true},
                    {"data": "cName",               "width": "100px",   "orderable": true},
                    {"data": "dRequested",          "width": "70px",    "orderable": true},
                    {"data": "dRequired",           "width": "70px",    "orderable": true},
                    {"data": "cProjectLeader",      "width": "100px",   "orderable": true},
                    {"data": "cComment",            "width": "450px",   "orderable": false},
                    {"data": "nPercentComplete",    "width": "50px",    "orderable": true}
                   ]
    });

Note that I am using scrollY with scroller and I am using an ajax datasource.

When I add a row, I am adding it to the back end table and then doing an ajax.reload(). When I edit a row, I update the back end and do the same. WHat I would like to do is then move the table so that the edited row is the first row shown/the added row is at the last row visible (if I have to put the added row as the first visible row, that's OK too).

Any ideas on how I might accomplish this?

This discussion has been closed.