Archivio
ExtJs 3: disable refresh button in PagingToolbar
this.pbar = new Ext.PagingToolbar({.......}); myGrid.on("afterrender", function() { this.pbar.refresh.hideParent = true; this.pbar.refresh.hide(); });
[ExtJs - TreePanel] How to change icon onClick
If we want to change icon when click on node, we can apply the following CSS class
.x-tree-selected .x-tree-node-icon {background-image:url(../images/myTheme/node-leaf-selected.png) !important;}
ExtJs: effettuare chiamare Ajax a pagine .aspx
Esempio banale sul come richiamare pagine .aspx da ExtJS:
Ext.Ajax.request({
url: 'test.aspx',
params: {
//lista dei parametri da passare alla pagina .aspx
},
success: function(result, request) {
//decodifico il JSON che mi viene restituito dalla chiamata alla pagina aspx
var objResult = Ext.util.JSON.decode(result.responseText)
alert('OK');
},
failure: function(result, request) { alert('Errore'); },
scope: this
});
Come noterete, decodifico il response della pagina .aspx perchè che mi faccio restituire un oggetto JSON. Della serializzazione JSON in ASP.NET 3.5, ne avevamo già parlato JSON serialization in ASP.NET 3.5
EXT JS: Modificare le dimensioni dei font con Ext.Slider
Da parecchio tempo sono impegnato nella realizzazione di un importante progetto con l’ ausilio del framework javascript Extjs. Tra le tante funzionalità richieste dal cliente, c’è quella di modificare le dimensioni del font dei testi e lo Slider mi è venuto in aiuto. Vi posto un pò di codice che ho scritto per l’ occasione sperando che possa esservi utile come spunto. Se avete qualche suggerimento sono tutto orecchi…
Dichiaro lo slider e l’ evento
var slider = new Ext.Slider({ width: 100 changeFontSize: function(startValue, endValue) { }, onChangecomplete: function(slider, newValue) {
, value: 12
, increment: 1
, minValue: 9
, maxValue: 15
, animate: false
, plugins: new Ext.ux.SliderTip()
});
slider.on('changecomplete', this.onChangecomplete, this);
this.sliderValue = 12;
this.removeClass(String.format('doc-font-{0}', this.sliderValue));
this.addClass(String.format('doc-font-{0}', endValue));
this.changeFontSize(this.sliderValue, newValue);
this.sliderValue = newValue;
}
Nella dichiarazione ho utilizzato il seguente plugin:
/** onSlide: function(slider) { getText: function(slider) {
* @class Ext.ux.SliderTip
* @extends Ext.Tip
* Simple plugin for using an Ext.Tip with a slider to show the slider value
*/
Ext.ux.SliderTip = Ext.extend(Ext.Tip, {
minWidth: 10,
offsets: [0, -10],
init: function(slider) {
slider.on('dragstart', this.onSlide, this);
slider.on('drag', this.onSlide, this);
slider.on('dragend', this.hide, this);
slider.on('destroy', this.destroy, this);
},
this.show();
this.body.update(this.getText(slider));
this.doAutoWidth();
this.el.alignTo(slider.thumb, 'b-t?', this.offsets);
},
return slider.getValue();
}
});
EXT JS: Impostare il body di una Ext.Window
Creando delle Ext.Window, vi sarete resi conto della mancaza dello sfondo del body. Ecco come impostarlo:
Creo una nuova Window chiamata “myWin”:
var myWin = new Ext.Window({ id:"myWin"
, title:"search result"
, .... .... });
Nel CSS creiamo una classe come segue ed il gioco è fatto:
#myWin .x-window-body { background:#fff !important; }