User data in dataprocessor

I am using the dataprocessor to edit a grid with data from a database table where some of the columns are populated by triggers after insert. Some of these columns are shown in the grid and some are added as user data. Is there any way such column values can be returned to the grid by the serverProcessor after an insert operation? The problem is that existing rows have userdata needed by scripts that the new rows are missing.



/Mikkel

You can set custom server side response. Please, see article in the documentation:

dhtmlx.com/docs/products/dht … usage.html

OK. I had hoped there was some build in feature. I managed to implement it as custom insert handler that accepts server responses like this:


 
 


It would be nice to have something like this as a build in feature in a future release.

this.dataProcessor.defineAction(“insert”, this.associateObjWithEvent(this, “afterInsert”));


GridObject.prototype.afterInsert = function(btag) {
    var grid = this.grid;
    var action = btag.getAttribute(“type”);
    var sid = btag.getAttribute(“sid”);
    var tid = btag.getAttribute(“tid”);

    for (var j = 0; j < btag.childNodes.length; j++) {
        var ctag = btag.childNodes[j];
        if (ctag.tagName == “userdata”) {
            grid.setUserData(sid, ctag.getAttribute(“name”), ctag.getAttribute(“value”));
        } else if (ctag.tagName == “column”) {
            var idx = grid.getColIndexById(ctag.getAttribute(“name”));
            if (idx!=undefined) {
                grid.cells(sid, idx).setValue(ctag.getAttribute(“value”));
            }
        } else {
            continue;
        }
    }
    return true;
};