Question
· Jun 9, 2016

$Buttun in $Gridx in Mojo Dojo

Hi
I'm trying to inser a button into a grid cell with no sucssess. You can see what I get, I don't understand what I'm doing wrong, can any one help me
Thanks
This is my code :
 
content {
children: [
{type:'$ContentPane',key:'layoutContainer-1',style:'width:100%;height:100%;',children:[
{type:'$span'},
{type:'$StoreMemory',key:'store-1',data:[
{id:2, title: 'Hey There 2', artist:[
{type:'$Button',key:'btn-stackContainer-prev',label:'Prev',title:'Advance to the previous content.',value:'Test value'},
]}
       
]},
{type:'$Gridx',key:'gridx-modules',style:'width:400px; height:300px;font-size:10%;',store:'store-1',columns:[
{field:'id',name:'Identity'},
{field:'title',name:'Title'},
{field:'artist',name:'artist'},
]
,modules:[{moduleClass:"gridx/modules/Filter"},{moduleClass:"gridx/modules/filter/QuickFilter"},{moduleClass:"gridx/modules/filter/FilterBar"},{moduleClass:"gridx/modules/dnd/_Dnd"},{moduleClass:"gridx/modules/dnd/Column"},{moduleClass:"gridx/modules/select/Column"},{moduleClass:"gridx/modules/dnd/Row"},{moduleClass:"gridx/modules/select/Row"},{moduleClass:"gridx/modules/move/Column"},{moduleClass:"gridx/modules/move/Row"}]},
                                                                                                                                
]},
]};

break;
 
 
 
Discussion (1)0
Log in or sign up to continue

Hi,

You need the CellWidget-module of gridx:

 {moduleClass:"gridx/modules/CellWidget"},

After that you need to define the Button in the column-JSON:

 {field:'colButtons', width:'80px', widgetsInCell: true, 
decorator: function(){return "<button data-dojo-type='dijit.form.Button' data-dojo-attach-point='btnDetails'></button>";}, 
setCellValue: function(gridData, storeData, cellWidget)
{
cellWidget.btnDetails.set('title', 'Details');
cellWidget.btnDetails.set('iconClass', 'detailsIcon');
cellWidget.btnDetails.set('showLabel', false); 
if(cellWidget.btnDetails._cnnt){cellWidget.btnDetails._cnnt.remove();} //remove all other callbacks
     cellWidget.btnDetails._cnnt = dojo.connect(cellWidget.btnDetails, 'onClick', function(e){alert(gridData);}); //create new onClick-Event
},
},