In dojo I intend to use my dialog box resizable by dragging the mouse over the rightmost corner edge. Dialog as such has no property to resize it. So I try to use Floating pane and then add the dialog as child. I plan to use the resizable property of Floating Pane for the child i.e dialog. Is this approach wrong ?
d = new Dialog({
title: "Testing Dialog",
content: "hi"
});
fp = new FloatingPane({
title: "Test",
resizable: true,
dockable: false,
style: "position:absolute;top:0;left:0;width:100px;height:100px;visibility:hidden;",
id: "fp"
}, dojo.byId("fp"));
fp.addChild(d);
fp.startup();
Thanks for the question and the advice Richard. This worked for me, I add it it here if someone else need something similar:
define([
'dojo/_base/declare',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'dojo/text!./DialogResize.html',
'dojox/layout/ResizeHandle',
'dijit/Dialog'], function (
declare,
_TemplatedMixin,
_WidgetsInTemplateMixin,
template,
ResizeHandle,
Dialog
) {
return declare('app.Dialog.Resize', [Dialog, _TemplatedMixin, _WidgetsInTemplateMixin], {
templateString: template,
// resizeAxis: String
// One of: x | xy | y to limit pane's sizing direction
resizeAxis: "xy",
postMixInProperties: function() {
this.inherited(arguments);
//console.log('DialogResize');
},
startup: function() {
//console.log('DialogResize startup');
// The orginal template was modifed by adding a resizeHandle handle, which is then initialised here
this._resizeHandle = new ResizeHandle({
targetId: this.id,
resizeAxis: this.resizeAxis
}, this.resizeHandle);
}
});
});
Then DialogResize.html:
<div class="dijitDialog" role="dialog" aria-labelledby="${id}_title">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="${id}_title"
role="heading" level="1"></span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="${buttonCancel}" role="button" tabindex="-1">
<span data-dojo-attach-point="closeText" class="closeText" title="${buttonCancel}">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent"></div>
${!actionBarTemplate}
<span dojoAttachPoint="resizeHandle" class="dojoxFloatingResizeHandle"></span>
</div>
It really depends on what aspect of the Dialog you're trying to replicate from the FloatingPane. If, for instance you want the default action pane and/or the Dialog overlay, then perhaps it's a better idea to just extend the Dialog and add a resize handler like the Floating Pane has.
If there are more aspects of a Floating Pane you like (e.g., moveable, resizeable, locked into a parent window), then perhaps you should extend the FloatingPane and add the properties of a Dialog that you like.
Either way though, it really depends on what you're trying to accomplish with this new Dialog and what features you need. Extending either would be my suggestion. I would not, however recommend accomplishing either by placing a Dialog into a Floating Pane because I can't see how it would accomplishes what you're trying to do. If you could explain your use case more, then I can give you a more concrete example.
[Edit]
You'll probably want to look at this: http://dojotoolkit.org/reference-guide/1.10/quickstart/writingWidgets.html to learn more about how to extend widgets.
Looking at the Floating Pane code, what you'll need to do is to add a resizeHandle to your extended Dialog that looks like this:
<span dojoAttachPoint="resizeHandle" class="dojoxFloatingResizeHandle"></span>
You'll then need to initialize it by doing something like this:
this._resizeHandle = new ResizeHandle({
targetId: this.id,
resizeAxis: this.resizeAxis
},this.resizeHandle);
Resize handle can be found at dojox/layout/ResizeHandle
Related
I would like to insert a text inside a v-progress-linear element (code sample below).
Is that possible ? And if yes, how can it be done ?
<v-progress-linear
background-color="pink lighten-3"
color="pink lighten-1"
value="15"
>
</v-progress-linear>
Support for text inside v-progress-linear is coming in 1.5.
<v-progress-linear value="50" height="20" background-color="pink lighten-3" color="pink lighten-1">
<div>text inside</div>
</v-progress-linear>
Here's a pen using the current beta for 1.5 https://codepen.io/anon/pen/YBNxdW
Edit: Sorry! Just noticed you specifically wanted this for the linear, not the circular. My notes below will handle the circular case. Perhaps ironically, after figuring this out for the circular I ran into the Vuetify Dialog Loader example which I went with for this project. It does a nice job of presenting text with a linear progress bar as a modal window. That said, leaving my original answer below in case anyone happens to want to add text to the circular version.
Original post: You can achieve this in a roundabout way with something like this. For context, we have the progress element defined at the app level and are toggling its display from child components when we make API calls. The gist of what's happening is there is an app level property for "showWait" which is either empty or contains the text "Please wait...". That property is used for both the v-show and the value of the progress element.
<v-progress-circular v-show="showWait" color="accent" size="70" width="7" value="showWait" indeterminate>
{{ showWait }}
</v-progress-circular>
Using a defined "showWait" data property:
var app = new Vue({
el: '#app',
data: {
showWait: ''
},
methods: {
ToggleWait() {
if (this.showWait == '')
this.showWait = 'Please wait...';
else
this.showWait = '';
}
}
});
I have just started with Dojo widgets. Recently, I did this Dijit Horizontal Slider Sample,and I have been wondering how to make a tooltip follow the slider handle with the current slider value as the tooltip content.
I have tried the same but am facing two issues:
One, the tooltip appears at the end of the slider rather than constantly hovering on the slider handle.
Two, the tooltip displays a value only when I stop sliding rather than changing seamlessly.
How to overcome these?
If you want the tooltip to move with the slider, you have to find a way to open it from the slider handle, not from the entire horizontal slider widget. I do not know if the actual slider you move with the mouse is it's own widget or not. From the declarative sample online the HTML for the handle looks like this
<div data-dojo-attach-point="sliderHandle,focusNode" class="dijitSliderImageHandle dijitSliderImageHandleH" data-dojo-attach-event="press:_onHandleClick" role="slider" aria-valuemin="-10" aria-valuemax="10" tabindex="0" aria-valuenow="4" style="position: absolute;"></div>
So you can try something like the following, if you can get a reference to the sliderHandle object.
/*
* Create the tooltip dialog that you want to show (I use tooltip dialog,
* but you can do the same with basic tooltip)
*/
var myTooltipDialogbase = new ttdialog({
id: 'myTooltipDialogBase',
style: "width: 275px;"
});
Then in your event handler (in this example right mouse click) you open the popup
/**
* On right mouse click, opens the tooltip dialog
*/
on(sliderHandle, 'contextmenu', function (event) {
popup.open({
parent: sliderHandle,
popup: myTooltipDialogbase,
around: sliderHandle.domNode
});
});
EDIT:
For your second question, you can use the slider property onChange() to do something each time the value of the slider changes. You must set intermediateChanges=true so onChange is called when sliding. In your case, in onChange(), if you can get a reference to the tooltip, then change the value of one of the tooltip objects for every value change of the slider.
I search how to deactivate the transition on compose data-bind,
because it not beautiful and little bug with my content html on chrome.
Because i have a scroll horizontal print on end on my transition and disaspear after move my mouse.
The content is in iFrame.
Thanks
You can disable transitions for compose by removing the "transition" option from the binding declaration.
Instead of:
<div data-bind="router: { cacheViews: false, transition: 'entrance' }"></div>
use:
<div data-bind="router: { cacheViews: false }"></div>
This example is for Durandal 2.0, although earlier versions work the same way.
There's more info in the docs here in the "Additional Settings" section.
(The transition framework is pluggable, so you can also write your own, using the default "entrance" transition as an example.)
Also need to remove the second parameter in setRoot call:
// Was
app.setRoot('viewmodels/shell', 'entrance');
// Done
app.setRoot('viewmodels/shell');
I have the following code for adding tooltip for onclick of a span id as shown below:
new dijit.Tooltip({
connectId: ['gridEditHelp'],
label: 'Double click on an item in the below table to perform inline editing of attributes',
position: ['above']
});
The problem is that I want the tooltip to be visible always on the web page.
Any ideas or existing API available for the same?
Use TooltipDialog instead - or else you will have to mess with the _MasterTooltip manager (there's more or less only one global, reusable tooltip). Then call dijit.popup.open - and never call .close
dijit.popup.open({
popup: new TooltipDialog({
id: 'myTooltipDialog',
style: "width: 300px;",
content: "<p>I have a mouse leave event handler that will close the dialog."
});,
around: dojo.byId('thenode')
});
i have a module. I need it to be able to display a modal dialog.
Seems like I need to inject a div into the main DOM and then parse it. Is this the right approach. Are there samples (or even a util- seems like this would not be that uncommon)
There are samples for almost everything in DojoCampus and in the tests directory:
var pane = dojo.byId('thirdDialog');
thirdDlg = new dijit.Dialog({
id: "dialog3",
refocus:false,
title: "Programatic Dialog Creation"
},pane);
Note that this particular widget doesn't need to be inserted to the DOM manually - it appends itself to the end of the page. Here the second parameter to the Dialog constructor - pane - is a reference to the node whose content should be displayed inside the Dialog.
UPDATE: Based on the new information you should try this:
dojo.require("dijit.Dialog");
dojo.addOnLoad(function() {
secondDlg = new dijit.Dialog({
title: "Programatic Dialog Creation",
style: "width: 300px",
content: "Insert text here"
});
secondDlg.show()
});
As shown here, you can pass Dialog content in the content attribute. (This sample is executable in FireBug on any page that includes Dojo.)
UPDATE: So, you want to have a form inside the Dialog? Nothing special here. Hey, you can even have a dijit form over there! Be sure to check out that DojoCampus article on Dialogs to learn how Dialog can communicate with a dijit form.
dojo.require("dijit.Dialog");
dojo.require("dijit.form.TextBox");
dojo.addOnLoad(function() {
secondDlg = new dijit.Dialog({
title: "Programatic Dialog Creation",
style: "width: 300px",
content: "<h2>Sample Form</h2>" +
"name: <input dojoType='dijit.form.TextBox' type='text' name='name' id='name'>"
});
secondDlg.show()
});
(Again this sample is executable in FireBug on any page that includes Dojo.)