Removing headertoolbar of GridPanel in Extjs - javascript

I have a GridPanel in Extjs and i just want to remove or hide its header toolbar. (The toolbar where the title and the searchbox is in). I just want the Gridpanels first element to be the column headers. How can I do it?

hideHeaders property of Ext.grid.GridPanel does the trick.
var grid = new.Ext.grid.GridPanel({
store: store,
hideHeaders: true,
width: 200,
height: 100,
}

Have you tried setting the header config option to false? See below example:
var grid = new Ext.grid.GridPanel({
store: store,
cm: cm,
header: false,
renderTo: 'mygrid',
width: 600,
height: 300
});

If you can't find a suitable config option, calling gridPanel.getTopToolbar().hide() afterwards should do the trick.

Related

EXTJS Display a View within Ext.window.Window

I am using version 4.2.
I currently have a view which extends a panel. On this panel there is a button which displays a modal window. The controller code when the button is clicked is below (which I pulled from the extjs docs):
displaySearch : function(btn) {
var panel = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
modal : true,
items: {
...
}
}).show();
}
I want a View I already have created to be rendered INSIDE the modal window I just defined.
How do I do that?
If you have defined an alias (xtype) for that view, let's say it is 'myview', then you just add it to items like this:
var panel = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
autoShow:true,
layout: 'fit',
modal : true,
items: [{
xtype:'myview'
}]
});
Also, you don't need to call show() on the created window, it is enough if you configure autoShow:true.

kendo ui grid batch editing, set focus

I working on a kendo ui grid. The grid is not-editable as default.
In the toolbar is a 'edit' button. When the user clicks on it, the grid should be editable in batch mode like this.
The only solution to get this work is remove and recreate the grid/datasource with new properties (editable:true etc).
This works as expected. Now I want to set the focus on the first row/cell, so that the user can see that the grid is editable now (in the example below the row becomes an input field).
Any suggestions for this?
Here is a fiddle for this.
$('.k-grid-edit').on('click', function (e) {
e.preventDefault();
// remove old grid
$('#grid').html('');
// recreate grid with edit: true and new datasource
$('#grid').kendoGrid({
dataSource: dataSourceInEdit,
editable: true,
columns: [{
field: 'TableId',
title: 'Id',
width: 50
}, {
field: 'Area',
title: 'Area'
}, {
field: 'Table',
title: 'Table',
width: 60
}, {
command: 'destroy',
title: ' ',
width: 100
}]
}).data("kendoGrid");
}); // end edit
Okay, I got it:
These 2 lines make it happen:
var grid = $("#rt_tableGrid").data("kendoGrid");
grid.editRow($("#rt_tableGrid tr:eq(1)"));
Certainly only on my local script, in the Fiddle I cant´t get it to work.
Although in the Docu is written: Requires "inline" or "popup"
Documentation here

extjs displaying loadmask on panel when store loads

I added a loadmask to a panel and I want the spinner to be displayed each time stores associated with the loadmask are loaded. The panel is a large tooltip and the stores are loaded each time a point is visited in a line chart. Thus, when I hover over a point, I'm expecting a load message to appear for a short period of time before I see the contents in the panel. What I'm getting is an empty panel however. If I remove the code that I have which adds the load mask (the initComponent function), it works (without the load message though). How would I use the loadmask in this manner as opposed to explicitly calling the setLoading() method for each panel?
Here's the code:
tips:
{
...
items:{
xtype: 'panel',
initComponent: function(){
var loadMask = new Ext.LoadMask(this, {
store: Ext.getStore('CompanyContext')
});
},
id: 'bar-tip-panel',
width: 700,
height: 700,
layout: {
type: 'accordion',
align : 'stretch',
padding: '5 5 5 5'
},
items:...
}
}
config object isn't the proper place to override initComponent method. What you should do is to define a subclass of Panel, and override the method there.
Ext.define('MyPanel', {
extend: 'Ext.panel.Panel',
xtype: 'mypanel',
initComponent: function() {
this.callParent(arguments); // MUST call parent's method
var loadMask = new Ext.LoadMask(this, {
store: ...
});
},
});
Then, you can use xtype mypanel in your tips configuration.

Scrollable tabpanel in window

I have a grid:
var koord_tab = new Ext.grid.EditorGridPanel({
title:"Координаты",
store: datastore,
region: 'center',
cm: cm_koord,
//height: 300,
autoScroll: true,
//bbar:[saveButton,cancelButton,editButton]
})
I have a window with tabpanel:
var x = new Ext.Window({
title:'Аттрибуты',
//height:390,
//autoWidth:true,
//autoHeight:true,
//autoScroll:true,
width:400,
listeners:{
'beforeclose':function(){
//app.mapPanel.map.removeLayer(myVecLayer);
for(var i=0;i<ppp.length;i++){
ppp[i].deactivate();
}
counter=0;
}
},items:[{
xtype:'tabpanel',
activeItem:0,
//autoScroll: true,
enableTabScroll : true,
//autoHeight:true,
height:340,
//collapseMode: "mini",
bbar:[saveButton,cancelButton,editButton],
items:[ed_tab,koord_tab]
}]
})
x.show();
Question: how to make tabpanel scrollable? When I open the window, I see this:
But when I resize the window, I see this:
You can see the toolbar doesn't show up. How can I make that toolbar always show, even if the window was resized?
UPDATE
I see only way to put bbar from tabpanel to window. But there is another problem: how to tabpanel and window unscrollable to have only one grid's scrollbar?
You're right to add the toolbar to the tabpanel.
For the other problem: get rid of the height: 340 config on your tabpanel and give it a layout: 'fit' config.
Then add another layout: 'fit' config on your gridpanel.
That should handle it.
Here is the fit layout in the ExtJS3 docs.

ExtJS buttons won't accept "id" config parameter?

I need specific IDs on ExtJS generated window buttons, but I'm having trouble specifying the ID. The documentation claims that this should be possible, but I still get an autogenerated id when I specify my own.
What gives?
dialog = new Ext.Window({
closeAction:'hide',
plain: true,
buttons: [
{
id: 'my-dialog',
text: 'Done',
handler: function() {
dialog.hide();
}
}
],
items:new Ext.Panel({
applyTo:'add-document-popup-panel'
}),
title: 'Add Documents',
layout: 'fit',
resizable: false,
draggable: false,
width: 300,
height: 300,
modal: true
});
}
dialog.show(this);
Check this topic: http://www.sencha.com/forum/showthread.php?24433-CLOSED-Cannot-assign-id-to-button-extjs-bug
The id of the container of the button is set, not the HTML button itself.
The id you specify is assigned to the button component (specific to extjs) and not necessarily to the underlying html button.
Does Ext.getCmp('my-dialog') successfully return the extjs button component?
The ID is set, but not on the actual button element. One of the containers is set with the correct id, and you can probably key off of this to get at whatever you need.
I had the same problem and I confirm:
The ID is set in the button's TABLE container.
Ext.getCmp('my-button') returns the extjs button component (object with xtype="button" and id="my-button").

Categories