prazanna007
4/11/2017 - 8:36 AM

Derived field datasource

Derived field datasource

//oGroupBy is custom(derived) field

schema: {
    model: {
        id: "oOrderId",
        fields: {
            "oOrderId": { type: "string", editable: false, nullable: true },
            "oAgentId": { type: "string", editable: false, nullable: true },
            "oGroupBy" : {type: "string", editable: false, nullable: false}
        }
    },

    parse: function (d) {
        $.each(d, function (idx, elem) {
            if (elem.oType.indexOf("DM") > 0) {
                elem.oGroupBy = elem.oArDt + "#" + elem.oAgentId + "#DM";
            } else {
                elem.oGroupBy = elem.oArDt + "#" + elem.oAgentId;
            }
        });
        return d;
    }

},