Extjs Alert Box without Header and Buttons - extjs

I need to create a Alert in Extjs plain with a text , but when we use Ext Message Box we get a header with close option and buttons. Please help me to alert the user only with a text message and should fade off after some seconds by default.

Have a toast! It's available since ExtJS 5.
Use header: false to hide the header. The autoCloseDelay is set in milliseconds, and defaults to 3000.
Example:
Ext.toast({html: 'Some alert here.', header: false, autoCloseDelay: 5000});
Edit: For centering the toast in ExtJS 6 and 5, see this fiddle:
https://fiddle.sencha.com/#fiddle/12ua

Instead of centering a toast (since you will need to do more hacking to not break toast like the other answer), why not extend Ext.window.MessageBox and handle it yourself? It does everything you want except it shows a header. Here's a fiddle example: https://fiddle.sencha.com/#fiddle/12ue
So now all you have to do is use it like:
Ux.Msg.alert('Welcome to Sencha Fiddle!');

Related

Extjs 3.4 how to change the tooltip of grid column header on Run time?

tooltip: dizionario.traduci("${GRCLI_SW_T_PERIODO}"),
This is my Sample Code, I am using Extjs 3.4.0 am trying to update the tooltip of grid column on runtime, I am using column.tooltip = "abc" it changes the tooltip config but on mouse hover I am not able to see updated tooltip
The case is normal and easy. Actually, if you change the tooltip from tooltip config of extjs you need to refresh your DOM
You just need to get grid first and then you get the column on which you want to change the tooltip.
Code:
gridColumn.tooltip = "updatedTooltip";
Then for refresh DOM you just do:
gridPanel.getView().updateHeaders();
Thank You :)

ExtJS Change Button UI

Using ExtJS5 I want my toolbar buttons to look like the normal ExtJS buttons. In the documentation I see the CSS Mixins but I am not putting things together. Can someone give me a kick in the right direction? Thanks.
Use defaultButtonUI in your toolbar:
defaultButtonUI : 'default'
See documentation of defaultButtonUI:
A default ui to use for Button items. This is a quick and simple way
to change the look of all child Buttons.
If there is no value for defaultButtonUI, the button's ui value will
get -toolbar appended so the Button has a different look when it's a
child of a Toolbar.
See https://fiddle.sencha.com/#fiddle/jpo

Hide collapse icon for collapsible panel in ExtJs

When I have a collapsible panel, ExtJs renders an icon in the tools area to expand/collapse, but also puts a little black triangle between the panels to do exactly the same thing.
I found in the documentation that I can hide the icon in the tools area, using hideCollapseTool:true, but I want to hide that little black triangle instead. How to do that?
Did you try split:false on the panel?
In Ext JS 5 (and likely some earlier versions as well) the split configuration parameter can be either a boolean value or a configuration object for an Ext.resizer.BorderSplitter object.
According to the API the collapsible property can be used to manually show or hide the collapse button in the splitter, so you can set that property to false to hide that button you're talking about.
The solution tested and working in 5.1 looks like this, assuming the panel is contained in a container with a border layout:
{
xtype: 'panel',
region: 'west',
split: {
collapsible: false
}
}
P.S. I know this is 2 years late but I found this question while looking for the solution myself. Figured I might as well share the solution from the API.
Edit: Made a fiddle. Also, it's worth mentioning that this retains all of the other splitter functionality that is lost if you use split: false, such as keeping the panel resizable.

ExtJS RowEditor How to render all the component validation on load

Hi everyone i got the following issue, i have a GridPanel with a RowEditor Nevertheless it doesnt validate my fields when it renders
But if i focus all my fields to edit and refresh the grid its just appear as i would like them in the first place
Can you suggest me something? Thanks!!
RowEditor uses Ext.form package components such as: "TextField" "DateField" "ComboBox" and so on... And validations are performed by them. Grid does't have such feature to validate. Validation feature may be achieved by renderer config option of column. For example, your Description column config might be looked like this:
{
header : 'Description',
dataIndex : 'description',
renderer :function(description, metaData){
if(!description){
//if description is blank let background of it be red.
medaData.style+="background-color:red;"; //or whatever css can be applied
}
return description;
}
}

How to refresh a panel after data is loaded?

I have a extjs panel rendered inside a div like this:
panel = new Ext.Panel({
layout : 'fit',
renderTo: 'my_div',
monitorResize: true, // relay on browser resize
height: 500,
autoWidth: true,
items : [
centerPanel
],
plain : true
});
After the page has loaded the panel is empty, but when I resize the browser the contents appears by magic!
I think the data has not finished loading when the panel is rendered the first time.
How can I get the contents to show without resizing the browser?
I suspect the issue is that you need to explicitly cause the panel to be rendered. After creating the panel, make the following call:
panel.doLayout();
Sencha documentation says "A call to this function is required after adding a new component to an already rendered container, or possibly after changing sizing/position properties of child components."
Any reason why you're nesting a panel within a panel? Seems like centerPanel could be directly rendered to your containing div. Also, the issue is most likely how you have centerPanel configured, or how you're loading it, neither of which you're showing here. You should not need to call doLayout() manually in this case, it's probably an issue with how your components are configured.
bmoeskau is right, also my guess is you have an async server request that loads your data (store.load, ajax, etc) -you could call the layout after that store loads by regestering a callback function (see sencha docs)
tedder suggestion helped me, but in itself did not solve a similar problem I had: adding one Ext.draw.Component I got a blank panel.
The curious part is, the panel looked white, but the DOM components were all there and I could inspect them using e.g. Chrome developer tools.
I got it working by using a workaround. I added those 2 instructions after the call to this.add(component):
this.setVisible(false);
this.setVisible(true);
Hiding the panel and then making it visible again, in some obscure way, does the job.

Resources