Login Register

Conditional Formatting

Hi All,
Is it possible to conditionally format a grids cell, based on the value it contains (like the one available in MS Excel)? Thanks in Advance...

Regards,
Yazad Khambata
yazad3@gmail.com

Any luck

Hi All,
I have still not be able to solve my problem, can some one please thro some light on the issue. I want to know whether this question I asked was too dumb to be answered in this forum or it should have been posted elsewhere? My apologies if there was something obvious in the tutorials that I have missed out... I have tried a lot of thing to fetch the value of an arbitrary cell on dojo.addOnLoad() with no luck... yes I am able to fetch values of a row when the row is clicked, using grid.model.getDatum(row, col)... bu that does not serve my purpose, I need the values of the cell on load (or at a certain interval when my grid is refreshed via AJAX calls).

Not only that, I am unable to get formatting bit to work... The code below works fine:

var view0 =
{
        cells:
        [
                [
                        {name: 'Roll', headerClasses: "headerClass"},
                        {name: 'Name'},
                        {name: 'Marks'},
                        {name: 'Is Active?'}
                ]
        ]
};

it even prints the value for me with

console.log("HeaderClasses: " + (grid.structure[0].cells[0][0].headerClasses));

but if i try to create a view without any header class and set it externally

like :

grid.structure[0].cells[0][0].headerClasses = "headerClass";

there is no format applied to the header...

If there is something obvious that i am missing out please let me know I will work on it... Thank you for your support.

Regards,
Yazad Khambata
yazad3@gmail.com

this is in the direction you

this is in the direction you want, IIRC the doc has specific example for what you want to do:

onStyleRow="configViewBladeCenterBladeListRowFormatter"

function configViewBladeCenterBladeListRowFormatter(inRow) {
        if(inRow.odd) {
                inRow.customClasses += ' dojoxGrid-row-odd';
        }
}

also, what about specifying

also, what about specifying a formatter? This is a little gem pottedmeat came up with:

var formatterFunc = function(value){
                if(dojo.isFunction(value)){
                        // Return a function that calls killQ and then
                        // calls value.
                        return function(value2){
                                return value(formatterFunc(value2));
                        }
                }
                if(value == "?"){
                        return " ";
                }
                return value;
        }

and just specify formatter:formatterFunc in each of your cells. This little piece of trickey removes the ??? from grid during loading, and still allows you to pass a custom formatter function to modify cells as they come in.

Thankx guys...

Thankx Guys