Sunday, 31 July 2016

Difference between renderer and convert

In Extjs everyone has small confusion what is the Difference between renderer and convert.

renderer: renderer is an "Interceptor" method which can be used to transform the data like value, appearence..before it rendered to the browser.

renderer: function (value, metaData, record, rowIndex, colIndex, store, view) {
    // style the cell using the dataIndex of the column
    var headerCt = this.getHeaderContainer(),
        column = headerCt.getHeaderAtIndex(colIndex);

    metaData.tdCls = 'app-' + column.dataIndex;
    return value;

It will returns the HTML string.

convert: convert is a function this converts the value provided by the reader into an object that will be stored into the Model.
This function access the rows information inside the store, based on this we can modify the data.