How to switch between cards in card layout - extjs

I have a card layout having two cards one with tab panel.Inside tab panel grid panel is there and another card is my content panel. I have to switch to next card i.e my content panel on cell click on my grid panel.
Have used the setActiveitem() function but something is wrong.
extend: Ext.panel.Panel,
id: 'cardpanel',
width: 300,
height: 1000,
reference: 'resultcardPanel',
itemid: 'cardPanel',
layout: {
type: 'card',
anchor: '100%'
},
activeItem: 0,
xtype: 'searchresults',
bodyStyle: 'padding:15px',
defaults: {
border: false
},
controller: 'email',
viewModel: {
type: 'email'
},
items: [{
xtype: 'tabpanel',
//id:'searchresults',
requires: [
'Ext.grid.Panel',
'Ext.toolbar.Paging',
'Ext.grid.column.Date'
],
cls: 'shadow',
activeTab: 0,
margin: 20,
///////////////////////////////////////////////////////
items: [{
xtype: 'grid',
cls: 'allRecordsCls',
scrollable: false,
border: false,
title: 'Primary',
routeId: 'inbox',
bind: '{inbox}',
itemclick: function() {
centerpanel = new Ext.Panel({
layout: 'card',
items: [homepanel, browser.grid]
});
centerpanel.getLayout().setActiveItem(1);
},
selModel: {
selType: 'checkboxmodel',
checkOnly: true,
showHeaderCheckbox: true
},
headerBorders: false,
rowLines: false,
scrollable: false,
listeners: {
itemclick: 'onGridCellItemClick2'
},
columns: [
{
dataIndex: 'from',
text: 'From',
width: 140,
},
{
dataIndex: 'title',
text: 'Subject',
flex: 1,
},
{
xtype: 'datecolumn',
dataIndex: 'received_on',
width: 90,
text: 'Received On'
}
],
},
//////////////////////////////////////////////////////////
{
xtype: 'grid',
cls: 'allRecordsCls',
scrollable: false,
border: false,
title: 'Social',
routeId: 'inbox',
bind: '{inbox}',
listeners: {
itemclick: 'clickme'
},
selModel: {
selType: 'checkboxmodel',
checkOnly: true,
showHeaderCheckbox: true
},
headerBorders: false,
rowLines: false,
scrollable: false,
columns: [
{
dataIndex: 'from',
text: 'From',
width: 140,
},
{
dataIndex: 'title',
text: 'Subject',
flex: 1,
},
{
xtype: 'datecolumn',
dataIndex: 'received_on',
width: 90,
text: 'Received On'
}
],
},
///////////////////////////////////////////////////////
{
xtype: 'grid',
cls: 'allRecordsCls',
scrollable: false,
border: false,
title: 'Promotion',
routeId: 'inbox',
bind: '{inbox}',
selModel: {
selType: 'checkboxmodel',
checkOnly: true,
showHeaderCheckbox: true
},
listeners: {
itemclick: 'onGridCellItemClick2'
},
headerBorders: false,
rowLines: false,
scrollable: false,
columns: [
{
dataIndex: 'from',
text: 'From',
width: 140,
},
{
dataIndex: 'title',
text: 'Subject',
flex: 1,
},
{
xtype: 'datecolumn',
dataIndex: 'received_on',
width: 90,
text: 'Received On'
}
],
},
],
},
///////////////////////////////////////////
{
id: 'cardPanel',
xtype: 'emaildetails'
},
]
what to write in function in "onGridCellItemClick2" which is declared in controller

Related

Right align button

I am using ExtJs 3.4
I am having a big problem with button 'Finish workflow' - I would like to right align that button. Everything that I've tried so far didn't work. Is there any way to do this?
var wndFinishWorkflow = new Ext.Window({
width: 500,
height: 300,
border: false,
padding: '20px',
closeAction: 'hide',
modal: true,
title: 'Finish workflow',
items: [
{
xtype: 'form',
border: false,
items: [
{
xtype: 'displayfield',
disabled: true,
fieldLabel: 'Workflow ID',
value: '49949494'
}]
},
{
xtype: 'form',
border: false,
items: [
{
xtype: 'displayfield',
disabled: true,
fieldLabel: 'WF status',
value: 'Finished'
}]
},
{
xtype: 'form',
border: false,
items: [
{
fieldLabel: 'Razlog',
xtype: 'appcombo',
width: 300,
store: new Ext.data.JsonStore({
idProperty: 'Id',
fields: ['Id', 'Name']
}),
displayField: 'Name',
valueField: 'Id',
editable: false,
allowBlank: false
}]
},
{
xtype: 'form',
border: false,
items: [
{
xtype: 'textarea',
width: 300,
fieldLabel: 'Komentar'
}]
},
{
xtype: 'form',
border: false,
items: [
{
xtype: 'button',
text: 'Finish workflow',
cls: 'x-btn-important',
handler: function () {
},
}]
}
]
});
You can use toolbar with '->' to move the items to right:
var wndFinishWorkflow = new Ext.Window({
width: 500,
height: 300,
border: false,
padding: '20px',
closeAction: 'hide',
modal: true,
title: 'Finish workflow',
layout: 'form',
items: [{
xtype: 'displayfield',
disabled: true,
fieldLabel: 'Workflow ID',
value: '49949494'
}, {
xtype: 'displayfield',
disabled: true,
fieldLabel: 'WF status',
value: 'Finished'
}, {
fieldLabel: 'Razlog',
//xtype: 'appcombo',
xtype: 'combo',
width: 300,
store: new Ext.data.JsonStore({
idProperty: 'Id',
fields: ['Id', 'Name']
}),
displayField: 'Name',
valueField: 'Id',
editable: false,
allowBlank: false
}, {
xtype: 'textarea',
width: 300,
fieldLabel: 'Komentar'
}],
bbar: {
xtype: 'toolbar',
items: ['->', {
xtype: 'button',
text: 'Finish workflow',
cls: 'x-btn-important',
handler: function () {
console.log('Button Click');
}
}]
}
}).show();

Ext JS - loading values in second grid based on row selection in first grid

I have 2 grids... In the first grid, I am showing some details but the second grid will be empty. When I choose any row in the first grid, the second grid has to show the values based on the row value from the first grid.
for 1st grid,
Ext.define('Admin.view.report004.Dashboard400',
{
alias: 'widget.report004.list400',
itemId: 'dashboard400',
title : 'Summary By Bank',
stripeRows: true,
border: true,
loadMask: {
msg: 'Please wait..'
},
extend: 'Ext.grid.GridPanel',
layout : 'fit',
bodyPadding: 10,
title: bundles.getLocalizedString('summary_by'),
store: report004Store,
features: [{
ftype: 'summary'
}],
columns: [
{id: 'report004CustomerName', header: bundles.getLocalizedString('customer_name'),
width: 150, sortable: false, hidden: false,
dataIndex: 'customerName',
align:'left',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<b>Totals</b>';
}
},
{id: 'report004Count', header: bundles.getLocalizedString('count'),
width: 150, sortable: false, hidden: false,
dataIndex: 'count',
align:'left'
},
]
});
For grid 2,
Ext.define('Admin.view.report004.Dashboard401',
{
alias: 'widget.report004.list100',
itemId: 'dashboard401',
title : 'By Specific Dataset',
stripeRows: true,
border: true,
loadMask: {
msg: 'Please wait..'
},
extend: 'Ext.grid.GridPanel',
layout : 'fit',
bodyPadding: 10,
title: bundles.getLocalizedString('xxx'),
store: dashboard_401,
features: [{
ftype: 'summary'
}],
columns: [
{
id: 'name2', header: bundles.getLocalizedString('name'),
width: 200, sortable: false, hidden: false,
dataIndex: 'name',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<b>Totals</b>';
}
},
{id: 'companyPaidCount2', header: bundles.getLocalizedString('paid_count'),
width: 150, sortable: false, hidden: false,
dataIndex: 'companyPaidCount',xtype: 'numbercolumn', format : '0,000',
align:'right',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex){
return "<b>" + value + "</b>";
}
]
});
Kindly help me on this..
Use select listener
for your first grid. grid select listener
Ext.define('Admin.view.report004.Dashboard400', {
alias: 'widget.report004.list400',
itemId: 'dashboard400',
title: 'Summary By Bank',
stripeRows: true,
border: true,
loadMask: {
msg: 'Please wait..'
},
extend: 'Ext.grid.GridPanel',
layout: 'fit',
bodyPadding: 10,
title: bundles.getLocalizedString('summary_by'),
store: report004Store,
features: [{
ftype: 'summary'
}],
listeners: {
select: function(grid, record, index) {
Ext.Ajax.request({
url: 'page.php',
params: {
id: record.get("id")
},
success: function(response) {
var data = Ext.decode(response.responseText);
dashboard_401.loadData(data);
}
});
}
},
columns: [
{
id: 'report004CustomerName',
header: bundles.getLocalizedString('customer_name'),
width: 150,
sortable: false,
hidden: false,
dataIndex: 'customerName',
align: 'left',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<b>Totals</b>';
}
}, {
id: 'report004Count',
header: bundles.getLocalizedString('count'),
width: 150,
sortable: false,
hidden: false,
dataIndex: 'count',
align: 'left'
},
]
});

Ayuda con extjs 4.2.2 soy nuevo en esto

I'm trying to make the bar that says my panel to collapse but I failed ... I am new to this framework I would like to give me a solution ..
Ext.define('MyApp.view.MyWindow', {
extend: 'Ext.window.Window',
requires: [
'Ext.toolbar.Toolbar',
'Ext.button.Button',
'Ext.grid.Panel',
'Ext.grid.View',
'Ext.grid.column.CheckColumn'
],
autoShow: true,
height: 401,
width: 970,
title: 'Linia de tiempo',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
dockedItems: [
/* {
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
text: 'MyButton'
}
]
} */
],
items: [
{
xtype: 'gridpanel',
title: ' ',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'string',
width: 250,
text: 'Grado y Sección'
},
{
xtype: 'checkcolumn',
text: 'Inicio'
},
{
xtype: 'checkcolumn',
text: 'Indice'
},
{
xtype: 'checkcolumn',
text: 'Proyecto1'
},
{
xtype: 'checkcolumn',
text: 'Proyecto2'
},
{
xtype: 'checkcolumn',
text: 'Proyecto3'
},
{
xtype: 'checkcolumn',
text: 'Proyecto4'
},
{
xtype: 'checkcolumn',
text: 'Cierre'
}
]
},
{
title : 'Collapsed Panel ' ,
collapsed: true,
collapsible : true,
anchura : 640 ,
//html : KitchenSink . DummyText . MEDIUMTEXT ,
colspan : 3
},
{
xtype: 'panel',
collapseMode: 'standard',
collapsed: true,
collapsible: true,
autoScroll: true,
split:true,
title: 'My Panel'
html: '<iframe src="http://www.google.com" style="width:100%;height:100%;border:none;"></iframe>'
},
/*{
title : 'Collapsed Panel ' ,
se derrumbó : true ,
plegable : true ,
ancho : 640 ,
colspan : 3
} */
]
});
me.callParent(arguments);
}
});
Here is an example for your problem,
Working fiddle is here
Ext.define('MyApp.view.MyWindow', {
//extend: 'Ext.panel.Panel',
extend: 'Ext.window.Window',
alias: 'widget.parentPanel',
requires: ['Ext.toolbar.Toolbar', 'Ext.button.Button', 'Ext.grid.Panel', 'Ext.grid.View', 'Ext.grid.column.CheckColumn'],
autoShow: true,
height: 401,
width: 520,
style:'margin-top: 200px',
title: 'Linia de tiempo',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
dockedItems: [],
items: [{
xtype: 'gridpanel',
title: ' ',
columns: [{
xtype: 'gridcolumn',
dataIndex: 'string',
width: 250,
text: 'Grado y Sección'
}, {
xtype: 'checkcolumn',
text: 'Inicio'
}, {
xtype: 'checkcolumn',
text: 'Indice'
}, {
xtype: 'checkcolumn',
text: 'Proyecto1'
}, {
xtype: 'checkcolumn',
text: 'Proyecto2'
}, {
xtype: 'checkcolumn',
text: 'Proyecto3'
}, {
xtype: 'checkcolumn',
text: 'Proyecto4'
}, {
xtype: 'checkcolumn',
text: 'Cierre'
}]
}, {
xtype: 'panel',
title: 'Collapsed Panel ',
collapsed: false,
collapsible: true,
anchura: 640,
colspan: 3,
items:[{
xtype: 'textfield'
},{
xtype: 'checkbox',
boxLabel: 'select',
boxLabelAlign: 'before'
}]
}, {
xtype: 'panel',
collapseMode: 'standard',
collapsed: true,
collapsible: true,
autoScroll: true,
split: true,
title: 'My Panel',
html: '<iframe src="http://www.google.com" style="width:100%;height:100%;border:none;"></iframe>'
}]
});
me.callParent(arguments);
}
});
Ext.widget('parentPanel', {renderTo: 'panel'});

how to show data store grid on ext.window.window.modal

I have a problem rendering data store grid on window modal.
here's the code on data.store :
var list_pp = Ext.create('Ext.data.Store', {
pageSize: itemsPerPage,
model: 'list_pp',
proxy: {
type: 'ajax',
api: {
read: pp_get_url,
create: pp_set_url,
update: pp_up_url,
destroy: pp_del_url
},
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount'
},
writer: {
type: 'json',
writeAllFields: true,
root: 'data'
}
},
//autoLoad: false,
listeners: {
write: function(store, operation){
var record = operation.getRecords()[0],
name = Ext.String.capitalize(operation.action),
verb;
}
}
});
here's the code that render on some page :
var grid_pp_list = Ext.create('Ext.grid.Panel',
{
width: '100%',
frame: false,
loadMask: true,
collapsible: false,
title: 'Detail PP',
store: list_pp,
columns: [
{
header: 'No PP',
width: 130,
sortable: true,
dataIndex: 'doc_no',
xtype: 'templatecolumn',
tpl: '{doc_no}<br/>{pp_id}/{sifat}<br/>'
}, {
header: 'Tgl.',
width: 100,
sortable: true,
dataIndex: 'pp_date',
xtype: 'datecolumn',
format:'y-m-d'
}, {
header: 'SBU Pemesan',
width: 160,
sortable: true,
dataIndex: 'org_order',
xtype: 'templatecolumn',
tpl: '{org_order}'
},{
header: 'Validasi',
width: 160,
sortable: true,
dataIndex: 'org_order',
xtype: 'templatecolumn',
tpl: '{org_order}'
},{
header: 'Action',
xtype: 'actioncolumn',
width: 60,
sortable: false,
menuDisabled: true,
xtype: 'templatecolumn',
tpl: 'Detail'
},{
header: 'Modified by',
width: 120,
dataIndex: 'modified_by',
sortable: true,
xtype: 'templatecolumn',
tpl: '<i class="icon-user"></i>{modified_by}'
},{
header: 'Modified Date',
width: 120,
sortable: true,
dataIndex: 'modified_date',
xtype: 'datecolumn',
format:'y-m-d H:m:s'
}]
here's the code on window modal :
var modal_pp = Ext.create('Ext.grid.Panel',
{
width: '100%',
frame: false,
loadMask: true,
collapsible: false,
title: 'Modal PP',
store: list_pp,
columns: [
{
header: 'No PP',
width: 130,
sortable: true,
dataIndex: 'doc_no',
xtype: 'templatecolumn',
tpl: '{doc_no}<br/>{pp_id}/{sifat}<br/>'
}, {
header: 'Tgl.',
width: 100,
sortable: true,
dataIndex: 'pp_date',
xtype: 'datecolumn',
format:'y-m-d'
}, {
header: 'SBU Pemesan',
width: 160,
sortable: true,
dataIndex: 'org_order',
xtype: 'templatecolumn',
tpl: '{org_order}'
}],
dockedItems:
[{
xtype: 'pagingtoolbar',
store: list_pp, // same store GridPanel
dock: 'bottom',
displayInfo: true
}]
});
here's generate trigger button trigger for modal window:
text: 'Generate',
iconCls: 'icon-add',
handler: function(){
if (!win) {
win = Ext.widget('window', {
closeAction: 'hide',
width: 1000,
height: 620,
minWidth: 300,
minHeight: 300,
layout: 'fit',
resizable: true,
modal: true,
items: modal_pp
});
}
win.show();
}
in rendering page everything is fine, but in window modal i can't render data store. please if anyone can give a guide or help i will be really appreciate it.
Remove width attributes from the modal grid. You cant specify width in % and if your containing parent has fit layout it doesn't matter anyway.
Wrap items in an array: items: [modal_pp]

Combobox and button in ExtJS Composite field

Iam Using compositfield for Combobox and edit button as side by side
for this my code is
{
xtype: 'fieldset',
title: 'Covered under warranty',
checkboxToggle: true,
labelAlign: 'right',
autoHeight: true,
width: 730,
items: [{
bodyStyle: 'padding-left:5px;',
layout: 'table',
autoHeight: true,
autoWidth: true,
layoutConfig: {
columns: 2
},
defaults: {
frame: true,
style: 'margin: 0 0 1px 3px'
},
items: [{
xtype: 'fieldset',
title: 'Warranty Manufacturer',
autoHeight: true,
width: 360,
labelWidth: 110,
items: [{
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Company',
items: [ComboComanyinWarranty, btnEdit]
}, {
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Company Location',
width: 220,
items: [ComboCompanyLocationInWarranty]
}, {
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Contact Person',
width: 220,
items: [ComboContactPersonInWarranty, {
xtype: 'button',
text: '...'
}]
}, {
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Contact Phone',
items: [{
xtype: 'displayfield',
value: ''
}]
}, {
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Contact Mobile',
items: [{
xtype: 'displayfield',
value: ''
}]
}, {
xtype: 'compositefield',
defaults: {
height: 20
},
fieldLabel: 'Contact Email',
items: [{
xtype: 'displayfield',
value: ''
}]
}]
}
}
but buttons are not displaying properly bottom part of the button cut.
so please help
Thanks in advance
Maybe autoheight isn't working? Try setting it to a fixed height...

Resources