Login Register

Formatting cell inside Grid

I am new to DOJO Grid widget and want to know that is it possible to customize format of data displayed inside particular cell in grid like adding icon or change aligement of text in cell .

u can use the

u can use the "get:functionname" field in grid defenition .

the function should return the data in required format like
return '

Or I think u can use "classes" field in grid definition

override the get method

If you want to change the style and look and feel, you can do the same in the get method, where you can return data to be returned along with the styles...

var data = [
            {'data11', 'data12', 'data13'},
            {'data21', 'data22', 'data23'}
           ];

var get = function(inRowIndex) {
        return data[inRowIndex][(this.index - 1)];
};

instead of above code, you can use something like below...

var get = function(inRowIndex) {
        var cellData = "";
        if (<| <| your condition |> |>) {
                cellData = '<font style="text-align: center;">' + data[inRowIndex][(this.index - 1)] + "</font>";
        } else {
                cellData = data[inRowIndex][(this.index - 1)];
        }
        return cellData;
};