小编Edi*_*ang的帖子

如何在extjs或javascript中创建动态CSS类

是否可以在extjs中为GridView创建动态css类,而无需在样式表中对css类进行硬编码,例如

 DEFAULT_ROW_COLOR = '#E0E0E0';
 ...
 var gridview = new Ext.grid.GroupingView({
  forceFit : forceFit,
  hideGroupedColumn : true,
  showGroupName : false,
  groupTextTpl: '{text}',
  getRowClass : getRowClassFunc
 });

 var getRowClassFunc = function(record, rowIndex, rowParams, store) {
   if (rowIndex == 1 ) {
     // create a dynamic class based on DEFAULT_ROW_COLOR for background color
   }  
   if (rowIndex > 1)  {
     // create a dynamic class for darker color for the background.
   }
 };
Run Code Online (Sandbox Code Playgroud)

javascript css extjs

5
推荐指数
1
解决办法
5604
查看次数

标签 统计

css ×1

extjs ×1

javascript ×1