Jump to content

Сoloring of the grid


Mediv

Recommended Posts

Hi Farshad.

Sorry. I'm probably not quite correct to explain my question,

I want to change the background color of entire rows, the first line - white, the next - gray, etc. not a color value in the cell.

Thank you.

Link to comment
Share on other sites

  • Administrators

For each column you need to write a proper renderer function in JS.

 

function OnReconfigure(sender, store, colModel)
{
 colModel.getColumnById(1).renderer=function(val, metadata, rec, row, col, store) {
     if (row==0)
       metadata.attr='style="background-color:green;"';
     return val;
 }; 

 colModel.getColumnById(2).renderer=function(val, metadata, rec, row, col, store) {
     metadata.attr='style="background-color:green;"';
     return val;
 }; 
}

Link to comment
Share on other sites

I do not know where Js, help me understand!

I want to loop through the rows and columns, the columns did, the problem with strings.

colModel.getColumnCount () returns the number to the columns.

colModel.getRowCount () returns a count of rows?

 

Or maybe I have an error in the other?

function OnReconfigure (sender, store, colModel)
{
  for (i = 0; i <colModel.getColumnCount() -1; i + +)
	{
     colModel.getColumnById (i). renderer = function (val, metadata, rec, row, col, store)
       {
         for (j = 0; k = 0; j <colModel.getRowCount () -1; j + +)
           {
             if (row == k)
               {
                 metadata.attr = 'style = "background-color: grey;"';
                 k = k + 2;
               };
             return val;
           };
       };
	};
}

Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...