I want to create an instance of the Edit widget inside a modal Dialog. The Dialog works fine with the textarea control, but once I attached the Editor, the editor does not display property.
HTML
<div id="servicio-dialog" title="Servicio">
<form id="servicio-dialog-form">
<ul class="mm-simple">
<li><label for="servicio-dialog-name">Categoria</label></li>
<li><input type="text" id="servicio-dialog-name" value=""/></li>
<li><label for="servicio-dialog-description">Descripcion</label></li>
<li><textarea id="servicio-dialog-description"></textarea></li>
</ul>
</form>
</div>
JavaScript
$("#servicio-dialog").wijdialog({
autoOpen: false,
modal: true,
resizable: false,
width: 600,
height: 480,
buttons: [
{ text: 'Acceptar', click : mm_onDialogAcceptar},
{ text: 'Cancelar', click: mm_onDialogCancelar}
],
captionButtons: {
pin: { visible: false },
refresh: { visible: false },
toggle: { visible: false },
minimize: { visible: false },
maximize: { visible: false }
}
});
$('#servicio-dialog-description').wijeditor({
mode: 'simple'
});
The easiest way to do it is to initialize it once the dialog is open:
$("#servicio-dialog").wijdialog({
autoOpen: false,
modal: true,
resizable: false,
width: 600,
height: 480,
buttons: [
{ text: 'Acceptar', click : mm_onDialogAcceptar},
{ text: 'Cancelar', click: mm_onDialogCancelar}
],
captionButtons: {
pin: { visible: false },
refresh: { visible: false },
toggle: { visible: false },
minimize: { visible: false },
maximize: { visible: false }
},
open:function(){
$('#servicio-dialog-description').wijeditor({
mode: 'simple'
});
}
});
Related
I already searched for this question for like more than 100 times and it´s always the same answers, but it doesn´t help me. So my question is:
How can I switch the views by click on a button in sencha touch 2?
I have 2 views:
first
Ext.define('Meet_Me.view.Menue', {
extend: 'Ext.Container',
alias: 'widget.Menue',
layot: 'card',
xtype: 'menue',
requires: [],
config: {
xtype: 'container',
layout: 'vbox',
centered: true,
items: [
{
xtype: 'container',
layout: 'hbox',
items: [
{
xtype: 'button',
text: 'Erstellte Events anzeigen',
width: 300,
height: 100,
margin: '30 5 5 30',
id: 'button1',
},
{
xtype: 'button',
text: 'Event erstellen',
width: 300,
height: 100,
margin: '30 5 5 30',
id: 'event_erstellen_button'
}
]
},
{
xtype: 'container',
layout: 'hbox',
items: [
{
xtype: 'button',
text: 'Event suchen',
width: 300,
height: 100,
margin: '30 5 5 30',
id: 'event_suchen_button'
},
{
xtype: 'button',
text: 'Teilnehmende Events anzeigen',
width: 300,
height: 100,
margin: '30 5 5 30',
badgeText: 'New',
id: 'teilnehmende_events_button'
}
]
},
{
xtype: 'container',
layout: 'hbox',
items: [
{
xtype: 'button',
text: 'Profil',
width: 350,
height: 100,
margin: '30 5 5 30',
//centered: true,
id: 'profil_button'
}
]
}
]
}
});
The important thing here is the Button with the id: 'button1'
The second view:
Ext.define('Meet_Me.view.Login', {
extend: 'Ext.Container',
alias: 'widget.Login',
xtype: 'login',
layot: 'card',
requires: [
'Ext.Panel',
'Ext.field.Email',
'Ext.field.Password',
'Ext.Button',
'Ext.Label'
],
config: {
items: [
{
title: 'Login',
xtype: 'panel',
itemId: 'homePanel',
layout: 'fit',
items: [
{
xtype: 'panel',
itemId: 'loginPanel',
//centered: true,
//margin: '5% 30% 0% 10%',
items: [
{
items: [
{
xtype: 'emailfield',
width: '70',
label: 'Email',
placeHolder: 'email#example.com'
},
{
xtype: 'passwordfield',
width: '70',
label: 'Passwort',
placeHolder: 'min. 6 Zeichen'
},
]
},
{
xtype: 'button',
id: 'loginButton',
margin: 20,
padding: 8,
text: 'Anmelden'
},
{
xtype: 'button',
itemId: 'registerButton',
margin: 20,
padding: 8,
text: 'Registrieren'
}
]
},
{
xtype: 'panel',
hidden: true,
itemId: 'welcomePanel',
items: [
{
xtype: 'label',
//centered: true,
html: 'Welcome!',
itemId: 'welcomeLabel'
}
]
}
]
}
]
}
});
and the Controller:
Ext.define('Meet_Me.controller.Main', {
extend: 'Ext.app.Controller',
requires: [
'Meet_Me.view.Login',
'Meet_Me.view.Menue',
],
config: {
touchstarttime: 0,
control: {
'#button1': {
tap: 'btn1click'
}
}
},
btn1click: function (button, e, options) {
console.log('Button 1 was clicked');
Ext.Viewport.add({
xtype: 'Login'
});
}
});
The problem is that the Login is shown but the first view with the 4 buttons is still there. How do get the first view removed?
you can use Ext.Viewport.animateActiveItem()
If you want to use 'card' layout, setActiveItem() is change items.
See following fiddle.
https://fiddle.sencha.com/#fiddle/16hu
I have a button and a grid (using jqGrid) but wanted to disable the button that is off the grid when the user clicks the checkbox that is within the grid. How do I do?
I'm trying to do this in LoadComplete.
<table id="Grid"></table>
<div id="GridPager"></div>
<br />
<button id="btnDownload" disabled="disabled">Download Selected</button>
<iframe id="ifr" style="display: none"></iframe>
<script>
$(document).ready(function () {
// make jQuery UI button
$("#btnDownload").button();
$("#btnDownload").click(function () {
var selectedIDs = jQuery('#Grid').jqGrid('getGridParam', 'selarrrow');
$("#ifr").attr("src", "/Handler/ExportInvoiceHandler.ashx?selectedIDs=" + selectedIDs);
});
$("#Grid").jqGrid({
url: '/Handler/InvoiceHandler.ashx',
datatype: 'json',
autowidth: true,
height: "100%",
emptyRecords: "No records found",
colNames: ['PO', 'SKU', 'Status', 'Date', ''],
colModel: [
{ name: 'PO', width: 80, sortable: true, stype: 'string', resizable: false },
{ name: 'SKU', width: 200, sortable: true, stype: 'string', resizable: false },
{ name: 'Status', width: 100, sortable: true, stype: 'string', resizable: false },
{
name: 'Date', width: 80, sorttype: "date", sortable: true, align: 'center', resizable: false,
searchoptions: {
dataInit: function (element) {
$(element).datepicker({ dateFormat: 'mm/dd/yy' })
}
}
},
{ name: 'Id', width: 50, sortable: false, search: false, index: 'Id', editable: true, formatter: returnHyperLink, align: 'center', resizable: false },
],
loadComplete: function () {
$("input[type=checkbox]").click(function () {
var chkSelected = $("#Grid input[type='checkbox']:checked").length;
var btn = $("#btnDownload");
alert(btn);
if (chkSelected != 0) {
btn.removeAttr('disabled');
}
else {
btn.attr('disabled', 'disabled');
}
});
},
rowNum: 10,
rowList: [10, 20, 30],
pager: '#GridPager',
multiselect: true,
sortname: 'PO',
viewrecords: true,
sortorder: 'asc',
loadonce: true
}).navGrid('#GridPager', { add: false, edit: false, del: false, refresh: false, search: true, refresh: true }, {}, {}, {}, { multipleSearch: true }, { closeOnEscape: true });
});
function returnHyperLink(cellValue, options, rowdata, action) {
return "<a href='/Handler/ExportInvoiceHandler.ashx?Id=" + options.rowId + "' target='ifr'>Download</a>";
}
</script>
I have a grid with very small columns with row filter, which cause them to have very small text-box. so I used
field: "OrderID",
width: 100,
filterable: {
cell: {
inputWidth: 65
}
}
but when I define inputWidth to enlarge the text field the filter operator does not move over and in fact cover up the partial space of the text-box. Therefore, I was wondering if there is a way to move the filter operator over or preferably over to the title header, like the columnMenu filter icon. Any help would be greatly appreciated, thanks.
I took the following example from: http://demos.telerik.com/kendo-ui/grid/filter-row
and modified width and inputwidth of orderID
<div id="example">
<div id="grid"></div>
<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read:"http://demos.telerik.com/kendo- ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
Freight: { type: "number" },
ShipName: { type: "string" },
OrderDate: { type: "date" },
ShipCity: { type: "string" }
}
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
},
height: 550,
filterable: {
mode: "row"
},
pageable: true,
columns:
[{
field: "OrderID",
width: 100,
filterable: {
cell: {
inputWidth: 65
}
}
},
{
field: "ShipName",
width: 500,
title: "Ship Name",
filterable: {
cell: {
operator: "contains"
}
}
},{
field: "Freight",
width: 255,
filterable: {
cell: {
operator: "gte"
}
}
},{
field: "OrderDate",
title: "Order Date",
format: "{0:MM/dd/yyyy}"
}]
});
});
Here is the output I require!
Here is how I try to achieve this:
win = Ext.create('Ext.window.Window', {
height: 650,
width: 500,
layout: 'fit',
border: false,
bodyPadding: 10,
modal:true,
itemId:'serviceCallWindow',
header: {
cls: 'n-service-call-window-header',
height: 80,
items:[{
xtype: 'component',
floating: true,
autoShow: true,
shadow: false,
focusOnToFront:false,
defaultAlign: 't',
autoEl: {
tag: 'img',
src: NG.serverMapPath('~/resources/images/support/support_icon.png')
},
componentCls: 'n-service-call-support-icon'
}]
},
items: [{
xtype: 'servicecall',
border: false,
bodyPadding: 10
}]
});
The challenge is to get the service call icon between the window header and body.
How can I achieve this?
This is achievable through manipulating CSS and the various layouts. You would perhaps also need to get rid of the header and actually make your own "close" button which would fire the windows close method.
such as below:
Ext.application({
name: 'Fiddle',
launch: function() {
win = Ext.create('Ext.window.Window', {
height: 300,
width: 500,
border: false,
bodyPadding: 10,
header: false,
modal: true,
layout: 'vbox',
itemId: 'serviceCallWindow',
items: [{
xtype: 'container',
/*layout: {
type: 'hbox',
pack: 'center'
},*/
width: '100%',
items: [{
xtype: 'image',
cls: 'testLogo',
style: {
margin: '0 auto',
width: '50px',
display: 'block'
},
src: 'http://placehold.it/50x50'
}, {
xtype: 'button',
cls: 'testClose',
style: {
top: 0,
right: 0,
position: 'absolute'
},
icon: 'http://placehold.it/20x20',
listeners: {
click: function() {
win.close();
}
}
}],
}, {
xtype: 'container',
border: false,
bodyPadding: 10,
html: 'this is the content of another container'
}]
});
win.show();
}
});
Demo: https://fiddle.sencha.com/#fiddle/g6t
http://jsfiddle.net/kKT2V/
$(document).ready(function () {
$('#te').dialog({
title: 'saved',
modal: true,
resizable: false,
draggable: false,
closeOnEscape: false,
width: 500,
buttons: [{
text: "Unpause",
click: function () {
$(this).dialog("close");
}
}]
});
clearInterval(interval);
});
This alert has a title and a button. Is there a way to change their position? I want to center them, for example.
http://jsfiddle.net/isherwood/kKT2V/2
.ui-dialog-titlebar, .ui-dialog-buttonset {
text-align: center;
float: none !important;
}
Your browser's document inspector is your friend.