Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Addling Different Styles to each cell in a list grid

    Hi so I have been looking for a way to add different cell style to each cell of a list grid. Mainly being able to color each cell of a list grid with a different color? I have a grid full of data and I want to be able to set a specific grid cell with a specific color. Any help would be great Thanks!

  • #2
    You can specify CSS styles for each row by overriding either getCellCSSText(record, rowNumber, columnNumber) or getCellStyle(record, rowNumber, columnNumber) in the creation of your ListGrid. For example:

    Code:
    isc.ListGrid.create({
        ID:"styledListGrid",
        getCellCSSText: function(record, rowNumber, columnNumber) {
            /*
             * Will change the color of the text in rowNumber 3+ a different color
             */
            if (rowNumber > 2) {
                return "color: #006699"
            }
            return "";
        }
    });
    or

    Code:
    isc.ListGrid.create({
        ID:"styledListGrid",
        getCellStyle: function(record, rowNumber, columnNumber) {
            /*
             * Will provide an alternate CSS style name to a record with id 2
             */
            if (record.id == 12) {
                return "table-row-highlight";
            }
            /*
             * Else will return the default CSS style name
             */
            return "cell";
        }
    });
    http://www.smartclient.com/docs/7.0r...getCellCSSText
    http://www.smartclient.com/docs/7.0r...d.getCellStyle
    Last edited by strandedmusician; 16th Feb 2010, 19:00.

    Comment


    • #3
      Yes I know about changing the style for each row but I want to change the style for each individual cell. For instance one cell in a row have a background color of yellow and then another in that same row have a background color of red

      Comment


      • #4
        I am having bit of same problem I want to show some rows( not only cell ) in bold based on the value of one cell Without affecting alternate row style. Like I have some columns in my grid same ItemName, ItemQty, deliveryTime, and status and I want to show whole row in bold when value of status is 'NEW'. I have override getCellCSSText method but it shows only status value in bold...
        Can any body give any Idea how to show whole row in bold.
        Last edited by dilip_gupta; 16th Jun 2011, 01:30.

        Comment

        Working...
        X