2013-07-26 16 views
6

jak utworzyć kolumnę akcji siatki ExtJs 4 z tekstem? to jest mój kodTworzenie kolumny akcji Extjs 4 z tekstem?

{ 
    xtype : 'actioncolumn', 
    text : lang('publish'), 
    width : 100, 
    tdCls: 'x-publish-cell', 
    items : [{ 
     getClass : function(v, meta, rec) { 
      if (rec.get('isPublished') == true) { 
       //this.items[0].tooltip = 'Test'; 
       return 'y'; 
      } else { 
       return 'n'; 
      } 
     } 
    } 

Jak utworzyć kolumnę działania ExtJS 4 siatki z tekstem?

+0

Chcesz, aby był to tekst bez obrazu lub z obrazem? – Reimius

+0

tekst z obrazem. jak [obrazek] [tekst tutaj] – user2622564

Odpowiedz

13

Możesz użyć kolumny renderer. Sztuką jest to, że Ext specjalnie ukryć regułę CSS, aby ukryć zawartość kolumn Działanie:

.x-grid-cell-inner-action-col { 
    line-height: 0; 
    font-size: 0; 
} 

Więc trzeba będzie zrekompensować to.

Przykład:

{ 
    xtype:'actioncolumn', 
    renderer: function() { 
     return 
      '<div style="float:right; font-size: 13px; line-height: 1em;">' 
       + 'Hey!' 
      + '</div>' 
    }, 
    items: [ 
     // ... 
    ] 
} 

Tutaj użyłem stylu inline, ale niestandardowej klasy CSS będzie prawdopodobnie lepiej.

Umożliwia teraz dodanie tekstu do kolumny. Jeśli chcesz dodać tekst w kolumnie dla elementu akcji, musisz zastąpić Ext.grid.column.Action#defaultRenderer.

+0

to działa. Dziękuję Ci ! – user2622564

+0

thanx mate szukałem tego samego problemu, okrzyki – kavinder

Powiązane problemy