How update Ext.Window - extjs3

I have gridpanel and for each row buttons with handler like (with chooser.js)
http://dev.sencha.com/deploy/ext-3.4.0/examples/view/chooser.html
in html button:
function deleteImage(data){
window.open("http://host/delete_file.php?file="+data.url,"_self");
};
function choose(btn){
if(!chooser){
chooser = new ImageChooser({
url:'http://host/get-images.php?path='+r.get('dtp'),
width:600,
height:350
});
}
chooser.show(btn.getEl(), deleteImage);
};
btn = new Ext.Button({
renderTo: id2,
text: 'Удалить',
width: 75,
handler: choose
});
If i cancel window(with image) and open on another row then openning first window with first images(not from new row).
In chooser.js cancel button:
{
text: 'Cancel',
handler: function(){ this.win.hide();},
scope: this
}
not close.
How after open new window update content(images from new row)?

It working:
function choose(v){
new ImageChooser({
url:'http://host/get-images.php?path='+r.get('dtp'),
width:600,
height:350
}).show(v, deleteImage);
};
new Ext.Button({
renderTo: id2,
text: 'Удалить',
width: 75,
handler: choose
});

Related

Ionic 5 toastController doesn't show "close" button

I migrated from Ionic 4 to Ionic 5 and noticed my toastControllers are not showing the "close" button even if I set up the ToastOptions properties with showCloseButton: true
I fixed it adding explicitly the buttons array like this:
let toast = this.toastCtrl.create({
message: 'User was added successfully',
showCloseButton: true,
position: 'top',
buttons: [
{
text: "close",
handler: () => {
console.log('Close clicked');
}
}
]
});

summernote editor - how to set codemirror default view?

i'm use codemirror on summernote.
i want default view is codeview.
So I searched on stackoverflow and google and found some ways.
first,
$(".summernote").summernote({
callbacks:{
onInit: function(){
$("div.note-editor button[data-event='codeview']").click();
}
},height: 300,
width: '100%',
minHeight: null,
maxHeight: null,
focus: true,
placeholder: 'please, write text here!',
lang: 'ko-KR',
codemirror: { // codemirror options
theme: 'blackboard',
lineNumbers: true
}
)};
However, this way does not work..
my summernote - codeview button has no [data-event='codeview'] tag.
button has class="note-btn btn btn-default btn-sm btn-codeview".
second,
$('.summernote').on('summernote.init', function () {
$('.summernote').summernote('codeview.activate');
}).summernote({
height: 300,
width: '100%',
minHeight: null,
maxHeight: null,
focus: true,
placeholder: 'please, write text here!',
lang: 'ko-KR',
codemirror: { // codemirror options
theme: 'blackboard',
lineNumbers: true
}
});
also does not work.
no no no,, the action is not the desired action.
When you do this, two spaces are created. Up and down.
As a result, I am using '$(".Summernote").Summernote("code",html code);' And I want the default view to be codeview.
$('.summernote').summernote({
callbacks: {
onInit: function() {
$('.summernote').summernote('codeview.activate');
}
}
});
worked for me

Uncaught TypeError: Failed to execute 'setStart' on 'Range': parameter 1 is not of type 'Node'.(…)

Trying to add class to only selected paragraphs in WordPress Editor.
Added a button called 'Add stylish '<li>' where there is an item called 'Includes'. So my need is to add class to the selected '<p>' when 'Includes' is pressed. Any help will be really grateful. Thanks!
(function() {
tinymce.PluginManager.add('sanjog_custom_tinymce_button', function( editor, url ) {
editor.addButton( 'sanjog_custom_tinymce_button', {
title: 'Add stylish <li>',
type: 'menubutton',
fixedWidth: true,
icon: 'icon dashicons-menu',
menu: [
{
text: 'Includes',
onclick: function() {
tinyMCE.activeEditor.focus();
tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.selection.select('p'),'test');
}
},
]
});
});
})();

ExrJs 3. How do I add a new element after the field?

In a series of receiving elements of the dynamic form. After some of these elements, I need to add plug-in.
Ie first went to the field, such as input, and automatically added after a new xtype.
Tried createChild, but for some reason he swears by xtype.
var formPanel = new Ext.form.FormPanel({
title: 'Test Form',
labelWidth: 120,
width: 350,
padding: 10,
tbar: [{
text: 'Add Item',
handler: function () {
formPanel.add({
xtype: 'textfield',
fieldLabel: 'My TextBox'
});
formPanel.doLayout();
}
}],
renderTo: 'output'
});
Demo here http://ext4all.com/post/extjs-3-how-to-add-a-new-field-dynamically

Sencha touch 2.0 and iphone : add element to panel dynamically and setActiveItem

I am trying to add dinamically a panel item to a main panel with a card layout which has initially one panel in it.
After one event (a tap) i build dinamically a new panel and I add it to the main panel, after this i try to set the new panel item like the active one via setActiveItem
Things work ok on Android but not on iphone.
Exactly i have this app.js:
Ext.Loader.setConfig({enabled: true});
Ext.setup({
viewport: {
autoMaximize: false
},
onReady: function() {
var app = new Ext.Application({
name: 'rpc',
appFolder: 'app',
controllers: ['Home'],
autoCreateViewport: false,
launch: function () {
Ext.create('Ext.Panel',{
fullscreen: true,
layout: {
type : 'card',
animation:{
type:'slide'
,duration :3000
}
},
defaults: { /*definisce le caratteristiche di default degli elementi contenuti..??*/
flex: 1
},
items:[{
title: 'Compose',
xtype: 'griglia'
}]
});
}
});
}
});
In a controller i have
.....
.....
var grigliaPan=button.up('griglia');
var mainPan=grigliaPan.up('panel');
var html=
'<img src="img/'+segnoScelto+'_big.png" />'
+'<h1>'+segnoScelto+'</h1>'
+'<p>'+previsione+'</p>'
+'</br></br>';
if (typeof mainPan.getComponent(1) == 'undefined'){
var previsioPan = Ext.widget('previsio');
previsioPan.setHtml(html);
//here i create a button for going home panel
var backButton=new Ext.Button({
ui : 'decline',
alias: 'widget.backbutton',
text: 'Home Page',
width : 150,
height:100
})
previsioPan.add(backButton);
var it=mainPan.getItems();
alert (it['keys']); //this prints : ext-griglia-1
mainPan.add(previsioPan);
var it=mainPan.getItems();
alert (it['keys']); //this prints : ext-griglia-1,ext-previsio-1
//
}
mainPan.getLayout().setAnimation({type: 'slide', direction: 'left', duration:1000});
//mainPan.setActiveItem(1);
var pree=mainPan.getAt(1);
//pree.show();
//mainPan.setActiveItemm(pree);
mainPan.setActiveItem('ext-previsio-1');
The three form of setActiveItem() are ok for Android and falls with iPhone. Can somebody please show me what is the right way to set the new active item added dinamically on the iphone ?
The problem should not be with the add() function cause i can see the new item via the getItems() added in main panel after the add().
by following code you can understand that thisCell is added later after creation of thisRow.
var thisRow = new Ext.Panel({
layout: { type: 'hbox', align: 'stretch', pack: 'center' },
id: 'row' + (rowCount + 1),
defaults: { flex: 1 }
});
// Now we need to add the cells to the above Panel:
var thisCell = new Ext.Panel({
cls: 'dashboardButton',
layout: { type: 'vbox', align: 'center', pack: 'center' },
items: [{
xtype: 'image',
src: 'some image url',
height: '70px',
width: '100px',
}]
});
thisRow.add(thisCell);
hope this will help you to achieve your desired output...