Auto Scroll is not working in viewport in Ext JS - javascript

I have to allow scrolling in the view port items. I tried the below code. But its not working.
var viewport = new Ext.Viewport({
layout :'column',
applyTo : 'divPanel',
items : [{
title: 'title',
collapsible: true,
autoScoll: true,
columnWidth: .57,
items: [grid],
width: 300
},{
columnWidth: .01,
},{
columnWidth: .42,
autoScoll: true,
collapsible: true,
items:[Panel],
width: 250
}]
});
Any help is must appreciated..thankz

In order to have a scroll, you must define a height on the components that are inside the ViewPort.

Related

Scrollbar location is wrong in layout : fit

I have a Panel and in that panel I am loading grid dynamically.
Here is code for panel
{
xtype: 'panel',
region: 'center',
frame: true,
scrollable: true,
itemId: 'MyGrid',
reference: 'MyGrid',
layout: {
type: 'vbox',
align: 'stretch'
},
items: []
}
and Sample of grid.
Ext.define("MyApp.view.MYGrid", {
extend: 'Ext.grid.Panel',
alias: 'widget.MyGrid',
requires: [
'Ext.grid.filters.Filters',
'Ext.form.field.ComboBox',
],
emptyText: 'No data available.',
disableSelection: true,
margin: '3 3 0 3',
collapsible: true,
multiSelect: false,
closable: true,
columnLines: true,
uniqueFields: [],
});
initComponent: function() {
var me = this;
me.fields = me.prepareFields(me.headersXmlDoc);
me.columns = me.prepareColumns(me.headersXmlDoc);
me.store = me.prepareGridStore(me.headersXmlDoc);
this.callParent(arguments);
},
Now when Grid have enough data then both horizental and vertical scroll is coming correctly but When grid have less data with more columns scrollbar is coming down. I supposed just beow the last record but it comming in down.
All the grid is taking same height though it have a less record.
Example pic
https://i.stack.imgur.com/RKdTb.png
I want scrollbar just below the last data. By debugging I found layout : fit
But not sure how to overcome out from that.
Can anybody help me that. Thanks for help.
You need to apply overflowY as true for grid.I don't think there is some problem with fit layout.If above config doesn't work share some fiddle.

how to vary splitter height dynamically in kendoUI splitter

I am using kendoUI splitter.In the left side I have a panel bar and in the right side I have the tabs.I want to increase the splitter height dynamically with the tab content height ,can any one help me how to do this.
I have defined like
$("#splitter").kendoSplitter({ //To Display horizantal splitter
panes: [
{ collapsible: true, size: "50%" },
{ collapsible: true, size: "50%" }],
orientation: "horizontal",
resize: function () {
alert($("#splitter").find(".k-pane")[1].scrollHeight);
//$("#splitter").css("height", $("#splitter").find(".k-pane")[1].scrollHeight);
}
});
but I am gettting "0" in the alert.
You should try the following:
var splitter = $("#splitter").kendoSplitter({ //To Display horizantal splitter
panes: [
{ collapsible: true, size: "50%" },
{ collapsible: true, size: "50%" }],
orientation: "horizontal",
resize: function () {
if(splitter) {
alert(splitter.wrapper.height());
}
//you can also get the panes each on it's own.
//check: console.log(splitter); to see what options are available
}
}).data('kendoSplitter');
splitter.trigger('resize');
Also look at the docs.
JsFiddle

How to remove horizontal scroll from grid?

I have a Grid Panel in ExtJs 3.4 app:
kad_tab = new Ext.ux.grid.livegrid.GridPanel({
store: store,
region: 'center',
cm: cm,
selModel: new Ext.ux.grid.livegrid.RowSelectionModel(),
stripeRows : true,
view: myView,
//height: 390,
loadMask: true,
id: 'kad_tab',
autoExpandColumn:'cadColumn',
title:'Земельные участки',
autoWidth:true,
autoScroll: true,
And view:
var myView = new Ext.ux.grid.livegrid.GridView({
nearLimit : 70,
autoFill: true,
scrollOffset: 0,
loadMask : {
msg : 'Buffering. Please wait...'
}
});
And how its look:
You see that there some problem with last row. I think its becouse horizontal scroll.
Its possible to remove horizontal scroll?
Try this
forceFit: true
inside viewConfig of the grid
use style:{overflowX:'hidden'} or {'overflow-x':'hidden'}.
'hidden' should be the class.
and also try autoscroll:false

panel not displayed sencha touch 2

I have a 'vbox' panel as below,
{xtype:'panel',
id:'srchResPanel',
layout:'vbox',
scrollable:false,
items:[
{
xtype:'toolbar',
docked:'top',
height:46,
style:'border-top-left-radius:10px;',
title:'some title'
}
]}
I am trying to add 2 panels dynamically to the above panel, they are as below
var header = Ext.create('Ext.Panel', {
height:40,
width:'100%',
scrollable: {
direction: 'horizontal',
directionLock: true
},
layout:'hbox',
});
header.setHtml('<div style="font-size:15px;>header</div>');
and
var grid = Ext.create('Ext.Panel', {
width:'100%',
scrollable: {
direction: 'horizontal',
directionLock: true
},
layout:'vbox',
});
Ext.getCmp('srchResPanel').add(header);
Ext.getCmp('srchResPanel').add(grid);
when i add the above 2 panels to the top panel, only the first panel(header) is displayed
the second panel(grid) is not getting displayed.
any help is appreciated.
thanks in advance.
You need to specify height for your second panel as well.

Getting height of ExtJS panel used as border region

I'm struggling mightily to get the height of an ExtJS panel and the only reason I can think it's any different is that it's the panel defined as a border region, because I've not had this problem otherwise (maybe I need to report a bug to them). I'll begin with some code that demonstrates how I'm trying to get the height, with results demonstrating what the height really is, what ExtJS says it is, and how it's not an issue with a panel using a different layout (one of the panels inside the border region):
'cmBuildTab #cmProductExplorer': {
afterrender: function(productExplorer) {
var domNode = Ext.getDom(productExplorer.el),
savedSearchesPanel = productExplorer.down('#savedSearchesPanel');
console.log('productExplorer.getHeight(): ' + productExplorer.getHeight());
console.log(productExplorer.componentLayout);
console.log(productExplorer.componentLayout.lastComponentSize);
console.log(domNode);
console.log('domNode.style.height: ' + domNode.style.height);
console.log('savedSearchesPanel.getHeight(): ' + savedSearchesPanel.getHeight());
}
},
I was initally encouraged I might have a couple of alternate ways to get the height, via the dom node, or via componentLayout.lastComponentSize but neither of these are accessible to Javascript code, only the chrome console. My final try then would be to parse the returned dom string but that is a horrible hack. Suggestions appreciated; below the console.log results is the pertinent portion of my view config.
console.log results:
productExplorer.getHeight(): 2
Ext.Class.newClass
autoSized: Object
borders: Object
calculateDockBoxes_running: false
childrenChanged: true
frameSize: Object
id: "dock-1155"
info: Object
initialized: true
initializedBorders: true
lastComponentSize: Object
height: 787
width: 254
__proto__: Object
layoutBusy: false
layoutCancelled: false
onLayout_running: false
owner: Ext.Class.newClass
previousComponentSize: undefined
targetInfo: Object
__proto__: Class.registerPreprocessor.prototype
undefined
<div id=​"panel-1049" class=​"x-panel x-box-item x-panel-default" role=​"presentation" aria-labelledby=​"component-1198" style=​"margin:​ 0px;​ width:​ 254px;​ height:​ 787px;​ left:​ 0px;​ top:​ 0px;​ ">​…​</div>​
domNode.style.height:
savedSearchesPanel.getHeight(): 151
View config (partial):
},{
region: 'west',
collapsible: true,
title: 'Product Explorer',
itemId: 'cmProductExplorer',
split: true,
width: '20%',
minWidth: 100,
layout: {
type: 'vbox',
pack : 'start',
},
items: [{
collapsible: true,
width: '100%',
border: false,
title: 'Search',
itemId: 'savedSearchesPanel',
items: [{
border: false,
xtype: 'cmSearchTermAccordionPanel'
},{
border: false,
margin: '5 20 0 20',
html: 'Saved Searches:<hr>'
}]
},{
afterrender is not the event you want to use to determine the heights of components, it fires when the elements have been rendered not after they have been sized. If you are using 4.1 you can use the boxready event which fires only once the the container is intially sized http://docs.sencha.com/ext-js/4-1/#!/api/Ext.AbstractComponent-event-boxready . If not you can use the afterlayout event to determine size but that event fires every layout.
Also fyi widths as percentages are not documented as supported in 4.0, I've seen them work and I've seen them fail.
Here is some code I hijacked from the Viewport example thanks to a court ruling this is ok.
4.1
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,
title: 'Navigation',
width: 150,
//ADD LISTENERS
listeners: {
afterrender:function(){console.log( 'afterrender ' +this.getHeight())},
boxready:function(){console.log( 'boxready ' +this.getHeight())}
}
// could use a TreePanel or AccordionLayout for navigational items
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'Information goes here',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel', // TabPanel itself has no title
activeTab: 0, // First tab active by default
items: {
title: 'Default Tab',
html: 'The first tab\'s content. Others may be added dynamically'
}
}]
});
Output :
afterrender 2
boxready 276

Categories