I am trying to create a small window with a text area inside every time the click of a button happens. However when I click the button more than once, a new window is created but only the first window contains the text area. Can anyone help?
var noteNumber = 0;
$("#createNoteButton").click(function () {
var noteWindowDivId = "noteWindow" + noteNumber;
$("<div id=noteWindowDivId />").appendTo(document.body).kendoWindow ({
draggable: true, resizable: true, width: "480px",
height: "100px", title: "Note",
scrollable: false,
modal: false, actions: ["Close"]
});
$("#noteWindowDivId").data("kendoWindow").content("<textarea id=noteNumber style='width: 100%; height: 100%'> </textarea>");
noteNumber++;
}
);
Related
I'm having displaying the content of a JSON file in a modal window. Currently i'm only able to display the file name as a link but what I would want to do is to display the content of that file. Any ideas how it is done. Below is my current code.
$("#adhocSearchKendoGrid").on("click", "a.open-modal", function() {
var dataItem = grid.dataItem($(this).closest("tr"));
$("<div></div>")
.appendTo($("#win"))
.kendoWindow({
title: "Editing item #" + dataItem.filename,
width: "40%",
modal: true,
position: {
top: 30
}
})
.data("kendoWindow")
.content("<a target='_blank' class='file-view'>" +dataItem.filename+"</a>");
//.maximize();
});
Use jQuery's load() method:
$("<div></div>")
.appendTo($("#win"))
.load("path/to/my/file", function() {
$(this).parent().kendoWindow({
title: "Editing item #" + dataItem.filename,
width: "40%",
modal: true,
position: {
top: 30
}
}).data("kendoWindow").center();
});
I'm working on a new project and I need to create an event where a menu list will show up once I right click on a label. Any idea how to do this?
When you click on a list from the menu box, a dialog box will appear. I do know how to create a dialog box but my problem is the right click event.
var createDialog = function(){
dialog = new Ext.LayoutDialog(id+'container', {
title: "DXFエクスポート",
width: 350,
height: 400,
shadow: true,
proxyDrag: false,
resizable: true,
modal: false,
autoScroll:true,
center: {
autoScroll:true
},
south: {
height: 60
}
});
I hope someone can give me an idea how to do mouse events.
I have a javascript function, which is opening a jquery dialog:
function new_popup() {
var editor = "victorio"; //want to give
var sex = "male"; //want to give
$("#new-dialog-form").dialog({
autoOpen: false,
height: 700,
width: 800,
modal: true,
title: "New Dialog",
buttons: { //.....buttons whatever.....
},
close: function() {
}
});
$("#new-dialog-form").load('<%=newPopupUrl%>').dialog('open');
}
I want to give the editor and the sex values for the new dialog, which opens the "new_frame.jsp", which has two labels with the IDs:
<label class="form_label" id="editor"/>
<label class="form_label" id="sex"/>
So when we open the new dialog, these 2 labels will be auto completed with the given values.
How can I give the values for the dialog, and how and where can I get and set the given values in the new jsp? Thank you for your helping!
Here is the dialog html:
<div id="login-prompt">
Please #Html.ActionLink("Log on", "LogOn", "Account", new { returnUrl = Request.RawUrl }, null)
or #Html.ActionLink("Register", "Register", "Account", new { returnUrl = Request.RawUrl }, null)
</div>
Here is the dialog initialization javascript:
$("#login-prompt").dialog({ autoOpen: false, width: 300, height: 100, modal: false });
And the function that opens the dialog:
function ShowLoginPrompt(context, leftOffset, topOffset) {
var position = context.position();
var loginPrompt = $("#login-prompt");
loginPrompt.dialog("option", "position", [position.left + leftOffset, position.top + topOffset]);
loginPrompt.dialog("open");
}
Regardless of the height I set during initialization, it is always auto in the resulting html.
I didn't track down the exact problem causing this but was able to correct it by stripping all custom styles and just using the default jquery dialog css file.
dial and place are the two divisions which exist in the html code that calls the function.
I am able to open up both of them but not able to embed the graph using plot in the 'place' division after it is opening up via the 'Draw' button.
It works fine only when I open both the boxes initially.
function abcd (dial,place,xrange){
var dial = conv(dial)
var xr = document.getElementById("xrange");
var yr = document.getElementById("yrange");
var gtype = document.getElementById("pattern");
xr.value = ""; yr.value = ""; gtype.value = "Line" ;
var place = conv(place);
$(dial).dialog("close");
$(dial).dialog("open");
$(place).dialog({
autoOpen: false,
show: 'Explode',
height: 500,
width: 450,
modal: true})
$(dial).dialog({
autoOpen: false,
show: 'Explode',
height: 300,
width: 350,
modal: false,
buttons :
{ "Draw" : function() {
$((place)).dialog("open");
$(function () {
//manipulate input values to plot data
$.plot(document.getElementById(plac2), [ {data:d1roe,label:"abc"},
{data:d1roa, label:"xyz"} ], {
series: {stack: 0},
xaxis: {ticks: ticks},
ticks: ticks
});
});
//function open(xyz) {$(xyz).dialog("open");}
function conv (myid) {
return ( '#' + myid );
}
I figured out a quick fix for it.
The problem was that the dialog will open but will not be manipulated by flot because it was unable to extract the width and height of the dialog box. So before opening the dialog we can fix the height and width.
Specifying height in the style sheet of html did not work in my case.
$(dial).dialog({
autoOpen: false,
show: 'Explode',
height: 300,
width: 350,
modal: false,
buttons :
{ "Draw" : function() {
$(place).width(500); // can take this as an input as well
$(place).height(500);
$(place).dialog("open");
//ploting code
}})}
The key thing you need for flot to work is for your plac2 div to have a width and height, and be visible (i.e. drawn to the screen). So before you plot, try alerting whether your div has width and height:
var placeholder = document.getElementById(plac2);
alert($(placeholder).width()+','+$(placeholder).height());
//plotting code here
Let us know what happens.