PDA

View Full Version : Loading a Dialog Layout from within a Table



bondindiasany
30 May 2007, 1:39 PM
Hello Experts,

Am trying to create a dashboard, for that I am using VBscript and I got the Table built. Below coding is some part of it.

--------------------------------------------------------------------------------------
<table cellspacing="1" cellpadding="2" border="1" width="100%" id="grid-table">
<thead>
<TR>
<TH>ServerName</TH>
<TH>Queue</TH></TR>
</thead>
<tbody><TR>
<%

FOr R = 0 to ubound(ExchangeServer)

ExchSrvr = trim(ExchangeServer(R))

%>

<TD><%=(Exchsrvr)%></TD>

<%
QueueStat = QueueStatus(ExchSrvr)%>


<%
If QueueStat = "Error" then %>
<TD><input type = "image" src = "/emc/images/Error.png" id="show-dialog-btn"/></TD>
<% elseIF QueueStat = "Red" Then %>
<TD><input type = "image" src = "/emc/images/Red.png" id="show-dialog-btn"/></TD>
<% elseIF QueueStat = "Green" Then %>
<TD><input type = "image" src = "/emc/images/green.png" id="show-dialog-btn"/></TD>
<% End IF %>
</TD></TR>
</Tbody>
</Tabel>
-------------------------------------------------------------------------------------
Am using ext grid in that table. Now the problem is I need to pop a Layout Dialog whenever a button(image) in the tabel is clicked. From the ext examples I came to understand that the below coding needs to be added below each button.

---------------------------------------------------------------------------------------
<div id="hello-dlg" style="visibility:hidden;">
<div class="x-dlg-hd">Layout Dialog</div>
<div class="x-dlg-bd">
<div id="center" class="x-layout-inactive-content" style="padding:10px;"></div></div></div>
----------------------------------------------------------------------------------------

And also in the Layout I need to load data as a table which is again retrieved by a VBscript. Could anyone help me out in this?

Any help is much appreciated...
Am a beginner in scripting and not much hands with Java scripting and ext stuffs..thanks for your time

regrds

bondindiasany
30 May 2007, 2:04 PM
If I Do an onclick = "function()" to the image button, is there any possiblity to get the layout dialog box popped up and load a grid with data fetched by calling a VBscript function?

tryanDLS
30 May 2007, 2:27 PM
Please post your code in 'code' tags so others can read it.
Adding inline click handlers is not a good practice - this has been discussed in several places - you might want to look at some of the tutorials as event handling is discussed.
I would also suggest you refer to the 'javascript newbies' thread at top of this forum for links to resources to learn more about JS coding.
You need to get in the habit of assigning unique IDs to your elements and making them meaningful to the context, not some function you think they should trigger.

jsakalos
30 May 2007, 2:33 PM
Is there any reason why you need to combine VBScript with JavaScript in one page? Or this is server-side VBScript?

bondindiasany
31 May 2007, 8:47 AM
Thanks for the replies, tim and jsa

I knew my script is ugly, not professional and sure I will go through the link in "Javascript - Newbies". Just Wondering what editor you guys use to make scripts. Am a Windows user, so please suggest some script editors that I can install and use on Windows Computer.

Back to our topic,
Am trying to use ext grids and layout dialog for the tables I create with Vbscript. The script is not a server-side script, but to use the ext I have to depend on the javascript and the coding examples I get from here. Can I use VBscript to call a EXT function??

For example ...with the above tabel codings

When a button is clicked in the GRID data the lazy loading layout dialog box should appear and the corresponding first cell value must be picked and passed to a VBSCRIPT function, which will in turn populate the layout with some data, probably another grid inside the layout.

The HTML line, actually a GRID Cell

<TD><input type = "image" src = "/emc/images/Error.png" onclick = "Opendialog()" /></TD>

Below is the Layout Dialog function(copied from the examples)

var LayoutExample = function(){
// everything in this space is private and only accessible in the HelloWorld block

// define some private variables
var dialog, showBtn;

var toggleTheme = function(){
Ext.get(document.body, true).toggleClass('ytheme-gray');
};
// return a public interface
return {
init : function(){
showBtn = Ext.get('show-dialog-btn');
// attach to click event
showBtn.on('click', this.showDialog, this);

},

showDialog : function(){
if(!dialog){ // lazy initialize the dialog and only create it once
dialog = new Ext.LayoutDialog("hello-dlg", {
modal:true,
width:600,
height:400,
shadow:true,
minWidth:300,
minHeight:300,
proxyDrag: true,

center: {
autoScroll:true,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: true
}

});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Close', dialog.hide, dialog);
var layout = dialog.getLayout();
layout.beginUpdate();
layout.add('center', new Ext.ContentPanel('center', {title: 'The First Tab'}));
layout.endUpdate();

}
dialog.show(showBtn.dom);
}
};
}();

// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
Ext.EventManager.onDocumentReady(LayoutExample.init, LayoutExample, true);

This is place I got struck up. Only If I add the <DIV> parts to the table the layout popsups..like

<TD><input type = "image" src = "/emc/images/Error.png" id="show-dialog-btn"/><div id="hello-dlg" style="visibility:hidden;">
<div class="x-dlg-hd">Layout Dialog</div>
<div class="x-dlg-bd">
<div id="center" class="x-layout-inactive-content" style="padding:10px;"></div></div></div></TD>

Why does the DIV needs to be there to load the Dialog? as it is a POPUP. And when calling the function opendialog() I can update the layout there with the data using

var layout = dialog.getLayout();
layout.beginUpdate();

var dialogCenter = Ext.get('center');
dialogCenter.load({

I need to call an asp page which uses a VBSCRIPT, and when run it will form the GRID
Could anyone make the coding as my needs and explain it?

Hope I made myself clear, please write back for any info...thanks again

jsakalos
31 May 2007, 10:56 AM
Sorry but I still don't understand the reason for VBScript. There are many Win users that use ASP as I have read on this forums but I see the VBScript question for the first time here.

Normaly, Ext is JavaScript library that uses XMLHttpRequest to get data from server asynchronously.

I'm missing why should I use VBScript to access the server. Also, you're forcing your users to use IE and AFAIK the number of Firefox users grows and there is also quite big Opera users community. What about them?

Anyone else knows better?


PS: If it's only because you're familiar with VBScript then my best advice is to grab a book and learn Javascript.

bondindiasany
31 May 2007, 12:46 PM
yes, its just because am familiar with VBscript, am a IT Specialist who configure mail servers, network monitoring and jobs related to it.
I use VBSCript to automate my daily tasks, now there is need to make web pages and am spending a lot of time in it, not sure if I will succeed.

I agree with you, there are many users using non IE browsers. Am writing you this reply from firefox.

jsakalos
31 May 2007, 2:06 PM
yes, its just because am familiar with VBscript, am a IT Specialist who configure mail servers, network monitoring and jobs related to it.
I use VBSCript to automate my daily tasks, now there is need to make web pages and am spending a lot of time in it, not sure if I will succeed.

I agree with you, there are many users using non IE browsers. Am writing you this reply from firefox.


In this case drop VBScript for web design.