extjs labelwidth in form of textfield not sizing to get bigger - extjs

the label of my textfield in ExtJS will not get bigger no matter what I try. It seems to be moving to 2 rows to accommodate size. Can anyone see what I am doing wrong?
I have a form, inside a fieldset, inside a panel.
Ext.define('ExtApplication4.view.admin.Admin', {
extend: 'Ext.panel.Panel',
xtype: 'app-admin',
controller: 'admin',
itemId: 'adminItemId',
requires: [
'ExtApplication4.view.admin.AdminController',
'ExtApplication4.util.GlobalVar'
],
title: 'Admin',
//html: 'This is my Admin Panel',
items: [{
xtype: 'fieldset',
title: 'database values',
width: 400,
items: [{
xtype: 'form',
//labelWidth: 200,
monitorValid: true,
formBind: true,
items: [{
//xtype: 'fieldset',
//title: 'database values',
//width: '100%',
defaultType: 'textfield',
margin: '10px,0,10px,0',
fieldDefaults: {
labelWidth: 200
},
items: [
{
allowBlank: false,
fieldLabel: 'Accrued',
itemId: 'itemIdAccrued',
name: 'nameAccrued',
emptyText: 'Accrued'
},
{
allowBlank: false,
fieldLabel: 'YTD End Val',
name: 'YTDEndVal',
emptyText: 'YTDEndVal',
itemId: 'itemIdYTDEndVal'
},
{
allowBlank: false,
fieldLabel: 'Margin Req',
name: 'MarginReq',
emptyText: 'MarginReq',
itemId: 'itemIdMarginReq'
},
{
allowBlank: false,
fieldLabel: 'MarginExc',
name: 'MarginExc',
emptyText: 'MarginExc',
itemId: 'itemIdMarginExc'
},
{
xtype: 'displayfield',
hideEmptyLabel: false,
value: 'All fields must be filled out',
style: 'text-align:left'
}
],
buttons: [{
text: 'Submit',
formBind: true,
listeners: {
click: 'onButtonSubmitPTValues'
}
}]

Instead of fieldDefaults use defaults as config property.
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
itemId: 'adminItemId',
title: 'Admin',
//html: 'This is my Admin Panel',
items: [{
xtype: 'fieldset',
title: 'database values',
width: 400,
items: [{
xtype: 'form',
//labelWidth: 200,
monitorValid: true,
formBind: true,
items: [{
//xtype: 'fieldset',
//title: 'database values',
//width: '100%',
defaultType: 'textfield',
margin: '10px,0,10px,0',
defaults: {
labelWidth: 200
},
items: [
{
allowBlank: false,
fieldLabel: 'Accrued',
itemId: 'itemIdAccrued',
name: 'nameAccrued',
emptyText: 'Accrued'
},
{
allowBlank: false,
fieldLabel: 'YTD End Val',
name: 'YTDEndVal',
emptyText: 'YTDEndVal',
itemId: 'itemIdYTDEndVal'
},
{
allowBlank: false,
fieldLabel: 'Margin Req',
name: 'MarginReq',
emptyText: 'MarginReq',
itemId: 'itemIdMarginReq'
},
{
allowBlank: false,
fieldLabel: 'MarginExc',
name: 'MarginExc',
emptyText: 'MarginExc',
itemId: 'itemIdMarginExc'
},
{
xtype: 'displayfield',
hideEmptyLabel: false,
value: 'All fields must be filled out',
style: 'text-align:left'
}
],
buttons: [{
text: 'Submit',
formBind: true,
}]
}]
}]
}]
});
}
});
<link rel="stylesheet" href="https://cdn.sencha.com/ext/gpl/4.1.1/resources/css/ext-all.css">
<script type="text/javascript" src="https://cdn.sencha.com/ext/gpl/4.1.1/ext-all-debug.js"></script>

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();

Trying to get two vbox next to each other

I have two vbox that I want right next to each other. However, only the first one is showing up. Why is this and how do I change it? Here is my code
layout: 'fit',
title: 'Avail Requests Details',
minWidth: 1000,
minHeight: 600,
width: 1174,
height: 600,
autoShow: true,
//listeners: {
// beforedestroy: 'onBeforeDestroy'
//},
items: [{
xtype: 'form',
reference: 'viewForm',
bodyPadding: 10,
defaults: {
xtype: 'container',
height: 25,
layout: {
type: 'column'
},
defaults: {
columnWidth: 0.3,
labelWidth: 140
}
},
layout: {
type: 'vbox',
},
items: [{
xtype: 'displayfield',
fieldLabel: 'CHANNEL',
name: 'Channel'
},
{
xtype: 'displayfield',
fieldLabel: 'ADVERTISER',
name: 'AdvertiserName'
},
{
xtype: 'displayfield',
fieldLabel: 'DEMO',
name: 'Demo'
},
{
xtype: 'displayfield',
fieldLabel: 'COMMENTS',
name: 'comments'
}],
layout: {
type: 'vbox',
},
items: [{
xtype: 'displayfield',
fieldLabel: 'CHANNEL',
name: 'Channel'
},
{
xtype: 'displayfield',
fieldLabel: 'ADVERTISER',
name: 'AdvertiserName'
},
{
xtype: 'displayfield',
fieldLabel: 'DEMO',
name: 'Demo'
},
{
xtype: 'displayfield',
fieldLabel: 'COMMENTS',
name: 'comments'
}]
}]
});
You have two items definition in your form, so second just overrite first, not adding new one. Also you have to use hbox layour for parent component.
I updated your code, check this fiddle.

Data Store has empty data property

I am working with Ext.js and trying to get a data Store set up and mapped to data fields on my FormPanel so that I can easily acess data input.
Something is missing in my mapping:
When I enter data in the textfields and hit my Submit button's submit handler, the data property on the store is blank. I was expecting it to contain data input on the page. Can someone help? Thanks very much:
infoPanel = function () {
this.store = new Ext.data.JsonStore({
autoLoad: true,
root: 'Data',
storeId: 'creditMemoStore',
fields: ['shipto', 'billto', 'reasonCode', 'creditClaimed', 'adjustmentAmount', 'poNumber']
});
this.fieldset = {
xtype: 'fieldset',
flex: 1,
border: false,
defaultType: 'field',
items: [
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Ship to',
name: 'shipto',
//dropdown
allowBlank: false
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Bill to',
name: 'billto',
//dropdown
allowBlank: false
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Reason Code',
name: 'reasonCode',
//dropdown
allowBlank: false
},
{
labelWidth: 160,
xtype: 'numberfield',
allowNegative: false,
fieldLabel: 'Amount',
allowBlank: false,
name: 'creditClaimed'
},
{
labelWidth: 160,
xtype: 'numberfield',
allowNegative: false,
fieldLabel: 'Adjustment Amount',
name: 'adjustmentAmount',
allowBlank: false,
maxLength: 5
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Customer PO Number',
allowBlank: false,
name: 'poNumber',
maxLength: 15
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Debit Memo Number',
allowBlank: false,
name: 'dmNumber',
maxLength: 50
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Credit Memo Number',
allowBlank: false,
name: 'cmNumber',
maxLength: 6
},
{
xtype: 'textfield',
labelWidth: 160,
fieldLabel: 'Currency Code',
name: 'currencyCode',
//dropdown
allowBlank: false,
maxLength: 3,
value: 'USD'
}
]
};
this.panel = new Ext.form.FormPanel({
renderTo: Ext.getBody(),
width: 700,
title: 'Create Credit Memo',
height: 400,
frame: true,
id: 'creditMemoFormPanel',
layout: 'vbox',
layoutConfig: {
align: 'stretch'
},
items: [
this.fieldset
],
store: this.store,
buttons: [
{
text: 'Reset',
handler: function () {
this.up('form').getForm().reset();
}
},
{
text: 'Submit',
formBind: true,
handler: function () {
var form = this.up('form').getForm();
var store = Ext.StoreMgr.get('creditMemoStore');
var dataObject = { testPost: store.data};
if (form.isValid()) {
Ext.Ajax.request({
url: 'CreateCreditMemo',
jsonData: Ext.JSON.encode(dataObject),
success: function() { Ext.Msg.alert('json post Success'); },
failure: function () { Ext.Msg.alert('json post Fail'); },
});
}
}
}
]
});
}
Ext.onReady(function () {
var ip = new infoPanel();
});
The Ext.js Store is only used for records where more than set of data is displayed at a time.
The Store doesn't apply to a basic form. The Ext.js Form posts the values of all of the fields automatically on submit.

How to perform checkbox checkevent?

I want a help for performing checkevent in a check box. Here is my code:
View.js:
Ext.define('AM.view.shop.Bill',
{
extend: 'Ext.form.Panel',
alias : 'widget.bil',
title: 'Complete Check Out',
defaultType:'textfield',
initComponent: function() {
this.items= [
// Mailing Address
{ xtype: 'fieldset',
title: 'Mailing Address',
defaultType: 'textfield',
layout: 'anchor',
width:520,
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: 'Street Address',
name: 'mailingStreet',
billingFieldName: 'billingStreet',
allowBlank: false
},
{ xtype: 'container',
layout: 'hbox',
items: [{
xtype: 'textfield',
fieldLabel: 'City',
name: 'mailingCity',
id:'mailingCity',
billingFieldName: 'billingCity',
flex: 1,
allowBlank: false
}]
}]
},
// Billing Address
{
xtype: 'fieldset',
title: 'Billing Address',
layout: 'anchor',
width:520,
defaults: {
anchor: '100%'
},
items: [{
xtype: 'checkbox',
name: 'billingSameAsMailing',
boxLabel: 'Same as Mailing Address?',
hideLabel: true,
checked: true,
style: 'margin-bottom:10px',
id:'billingSameAsMailing',
},
{ xtype: 'textfield',
fieldLabel: 'Street Address',
name: 'billingStreet',
//style: 'opacity:.3',
disabled: true,
allowBlank: false
},
{ xtype: 'container',
layout: 'hbox',
items: [{
xtype: 'textfield',
fieldLabel: 'City',
name: 'billingCity',
id:'billingCity',
style: (!Ext.isIE6) ? 'opacity:.3' : '',
flex: 1,
disabled: true,
allowBlank: false
}]
}]
}]
this.callParent(arguments);
}
});
controller.js:
Ext.define('AM.controller.Shops', {
extend: 'Ext.app.Controller',
init: function() {
this.control({
'bil textfield[name=mailingCity]' : {
change: function(textField) {
var formpanel = Ext.ComponentQuery.query('bil')[0];
var copyToBilling = formpanel.down('[name=billingSameAsMailing]').getValue();
if (copyToBilling) {
var city=formpanel.down('[name=mailingCity]').getValue();
formpanel.down('[name=billingCity]').setValue(city);
}
}
},
'bil checkbox[name=billingSameAsMailing]': {
check: function(item, checked) {
alert(item);
}
}
});
}
});
I use the same method of textbox, to get a particular checkbox for performing event on
that checkbox. In textbox it's working correctly but in the case of checkbox it does not respond.
You just try the following code.It works For me.
item.checked = true;

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