domingo, 26 de junio de 2011

how add a listener to a grid extjs

w add a listener to a grid extjs

var grid = new Ext.grid.GridPanel({
store: store,
cm: cm,
listeners: {
      cellclick: function(grid, rowIndex, colIndex) {
          if (colIndex > 0) {
              var rec = grid.store.getAt(rowIndex);
              rec.set('value', colIndex);
              //get value here from colindex+rowindex.
         }
      }
   }
});

Set BackgroundImage of a Panel

Set BackgroundImage of a Panel extjs

If you have frame:true then you can set CSS to do it:

.panelname .x-panel-body {
background-color:transparent;background-image:url(images/bg_top.png) !important;background-repeat: no-repeat;
}


region: 'north',
collapsible: false,
split: false,
height: 80,
border : false,
cls:'norte'
},{

lunes, 6 de junio de 2011

Abrir ext.panel onclick, open ext.pnale onclick event

Abrir ext.panel onclick, open ext.pnale onclick event

Ext.onReady(function(){
    var mypanel = new Ext.Panel({
        title: 'My Panel',
        collapsible:true,
        width:500,
        html: Ext.example.bogusMarkup
    });
    var myButton = Ext.get('myHrefIdClick');
        myButton.on('click', function(){
            //render the panel to id -> 'container'
            mypanel.render('container');
    });
}); //onReady Close

<h1>onClick of a link opens up a Panel</h1>
<a href="#" id="myHrefIdClick">Click Here</a>
<div id="container">
</div>
 
 
Abrir ext.panel onclick, open ext.pnale onclick event
Añadir evento on click a un enlace en extjs

nested tab extjs sencha code

How to make nested tabs in extjs sencha
Como crear tabs añidados en extjs



<script language="javascript">
Ext.onReady(function(){
    //parent tabs
    var tabs = new Ext.TabPanel({
        renderTo: 'tabsContainer',
        width:450,
        activeTab: 0,
        frame:true,
        defaults:{autoHeight: true},
        items:[
            {contentEl:'parentTab1', title: 'Parent Tab1'},
            {contentEl:'parentTab2', title: 'Parent Tab2'}
        ]
    });

    //subtabs
    var subtabs = new Ext.TabPanel({
        renderTo: 'parentTab1',
        autoWidth:true,
        activeTab: 0,
        frame:true,
        defaults:{autoHeight: true},
        items:[
            {contentEl:'childTab1', title: 'Sub Tab1'},
            {contentEl:'childTab2', title: 'Sub Tab2'}
        ]
    });

    //subtabs
    var subtabs = new Ext.TabPanel({
        renderTo: 'parentTab2',
        autoWidth:true,
        activeTab: 0,
        frame:true,
        defaults:{autoHeight: true},
        items:[
            {contentEl:'childTab3', title: 'Sub Tab3'},
            {contentEl:'childTab4', title: 'Sub Tab4'}
        ]
    });

});
</script>

How to make nested tabs in extjs sencha
Como crear tabs añidados en extjs




Ext sencha grid with datasource

 Extjs grid con  datasource reader json example,ejemplo
Ext sencha grid with datasource
 
Ext.onReady(function()
{
  Ext.QuickTips.init();
 
 // ----------------
 // vars
 // ----------------
 var ds; // datasource var
 
 // ----------------
 // Create datasource
 // ----------------
 function createDS()
 {
  ds = new Ext.data.Store({
         proxy: new Ext.data.HttpProxy({
             url: 'search.php', // serverside script to post to
             method: 'POST' // method of posting .. GET or POST .. I've used POST
         }),
 
         // the reader
            reader:  new Ext.data.JsonReader({
    totalProperty: 'total',
    root: 'results', // the object wich old the records
    id: 'id', // the fieldname wich hold the id ... optional
    fields: ['id','name','email','comments'] // the fields the reader need to render 
   })         
 
  });    
 }
 
 createDS();     
});