rice-framework/krad-web/src/main/webapp/krad/scripts/krad.utility.js
/**
 * Private function called by the mDataProp option in the datatables jquery plugin and is used specifically to
 * supply the correct display and value information
 * from the rowData used by the uif in our RichTable widget which are backed by custom uif json object arrays
 *
 * @param rowObject the current object containing columns denotated by 'c' + column index
 * @param type the type of value handling requested handling set, sort, display here
 * @param colName the column name to retrieve ('c' + column index) from the rowObject
 * @param newVal the new value to set during a set call
 * @return {*} the value requested or nothing during a set
 * @private
 */
Private function called by the mDataProp option in the datatables jquery plugin and is used specifically to
supply the correct display and value information
from the rowData used by the uif in our RichTable widget which are backed by custom uif json object arrays


Private function called by the mDataProp option in the datatables jquery plugin and is used specifically to supply the correct display and value information from the rowData used by the uif in our RichTable widget which are backed by custom uif json object arrays
function _handleColData(rowObject, type, colName, newVal) {
    var colObj = rowObject[colName];
    if (!colObj) {
        return "";
    }
    if (type === "set" && newVal && newVal != colObj.val) {
        colObj.render = jQuery(newVal).html();
        colObj.val = coerceTableCellValue(newVal);
        return;
    } else if (type === "display") {
        return colObj.render;
    } else if (type === "sort") {
        var sortValue = colObj.val;
        if (sortValue == null) {
            sortValue = colObj.render;
        }
        if (colObj.render) {
            var field = jQuery(colObj.render);
            var isInput = field.is("[data-role='InputField']");
            if (isInput) {
                var id = field.attr("id");
                var control = field.find("[data-control_for='" + id + "']");
                if (control.length) {
                    sortValue = coerceValue(control.attr("name"));
                }
            }
        }
        return sortValue;
    }
    return colObj.val;
}
function _handleColData ( rowObject , type , colName , newVal ) { var colObj = rowObject [ colName ] ; if ( ! colObj ) { return "" ; } if ( type === "set" && newVal && newVal != colObj . val ) { colObj . render = jQuery ( newVal ) . html ( ) ; colObj . val = coerceTableCellValue ( newVal ) ; return ; } else if ( type === "display" ) { return colObj . render ; } else if ( type === "sort" ) { var sortValue = colObj . val ; if ( sortValue == null ) { sortValue = colObj . render ; } if ( colObj . render ) { var field = jQuery ( colObj . render ) ; var isInput = field . is ( "[data-role='InputField']" ) ; if ( isInput ) { var id = field . attr ( "id" ) ; var control = field . find ( "[data-control_for='" + id + "']" ) ; if ( control . length ) { sortValue = coerceValue ( control . attr ( "name" ) ) ; } } } return sortValue ; } return colObj . val ; }
Private function called by the mDataProp option in the datatables jquery plugin and is used specifically to
 supply the correct display and value information
 from the rowData used by the uif in our RichTable widget which are backed by custom uif json object arrays
Private function called by the mDataProp option in the datatables jquery plugin and is used specifically to supply the correct display and value information from the rowData used by the uif in our RichTable widget which are backed by custom uif json object arrays