PDA

View Full Version : Css Help ?!



Shmitt
14 Sep 2008, 10:40 AM
Hi guys!

Here having a problem with coloring some columns. So having 2 rows from mygrid:

aplicare_chimie
denumire_lucrare

With some data in it:

aplicare_chimie denumire_lucrare
yes lucrare1
yes lucrare2
no lucrare3
yes lucrare4

I wanna colorate second column denumire_lucrare but only the data wich coresspund to 'yes' from the first column:aplicare_chimie.
Need to obtain this result:

aplicare_chimie denumire_lucrare
yes lucrare1
yes lucrare2
no lucrare3
yes lucrare4


How it's can be done?!

Some help will be great!

14 Sep 2008, 3:00 PM
You can do it with a custom renderer easily.

mjlecomte
14 Sep 2008, 4:20 PM
If you are talking about grid, then look at FAQs, there is section for grids in FAQ, check the area for "appearance" which has examples for using renderers, etc.

Shmitt
14 Sep 2008, 10:19 PM
Ok thx for help guys!

It's really was a piece of cake.
About the row coloring here i have a problem. Here is the code:


var gridViewTest = new Ext.grid.GridView({
//forceFit: true,
getRowClass : function (row, index) {
var cls = '';
var data = row.data;
switch (data.volum_de_lucru) {
case 0 :
cls = 'readonlycell'
break;
}//end switch
return cls;
}
}); //end gridViewTest
where the volum_de_lucru is a field(column in my grid) which contains numeric data. And i need to colorate each row where the value of volum_de_lucru is 0 (zero).

The editorGridPanel :


var MainListingWindow = new Ext.grid.EditorGridPanel({
// id: 'MainListingWindow',
title: 'Caracteristici operaţionale',
store: MainDataStore,
cm: MainColumnModel,

... //some other options

view: new Ext.grid.GroupingView({
//forceFit:true,
//groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
showGroupName: true,
enableNoGroups:false, // REQUIRED!
hideGroupedColumn: true

}),

.... //some other options

});

Now where i'll put the gridViewTest in the EditorGridPanel, if i allredy have a view declared there?!

And if there are other easy:D ways to solve the problem?!

Of course, it can be done with sample custom renderer defined in each column of the grid, but it's dirty and having a really big grid here with many columns.

--------
Also, i hope someone can iluminate me with thouse css:
i wanna colorate only the text in a specified column, how can i do this?
i have a file style.css where is specified class: 'aplicachimie':


.aplicachimie{
background-color: red;
}

and it's works fine in my custom renderer:

...
metaData.css = 'aplicachimie';
...


But when i wanna colorate only the text:

.aplicachimie{
color: red;
}

and the renderer remains unchange, then no effects on text?! why?!
Hope somebody can help me!

Thx in advance!

mjlecomte
15 Sep 2008, 4:58 AM
Try:


[PHP]

var MainListingWindow = new Ext.grid.EditorGridPanel({
//forceFit: true,
getRowClass : function (row, index) {
var cls = '';
var data = row.data;
switch (data.volum_de_lucru) {
case 0 :
cls = 'readonlycell'
break;
}//end switch
return cls;
},

// id: 'MainListingWindow',
title: 'Caracteristici opera

mjlecomte
15 Sep 2008, 4:59 AM
Try:


[PHP]

var MainListingWindow = new Ext.grid.EditorGridPanel({
// id: 'MainListingWindow',
title: 'Caracteristici opera

Shmitt
22 Sep 2008, 5:15 AM
Solved.

Done it in the easy way, not very clever, only with renderer for each column, but it works good.

Thx for the help mjlecomte, i'll try to use your hints.