For a few simple tasks like an accordion menu and a grid I started testing the ExtJS JavaScript library and I have to say, once you get the hang of it, it’s pretty straight forward and helps to achieve results in no time. A few interesting code snippets for the accordion menu can be found here.
var onloads = new Array();
function bodyOnLoad() {
for ( var i = 0 ; i < onloads.length ; i++ )
onloads[i]();
}
function registerAjaxRequest() {
ajaxEngine.registerRequest( ‘getRequest’, ‘findtemplate2.cgi.pl’ );
ajaxEngine.registerAjaxElement( ‘Request’ );
}
function setStatus(s,n) {
\$(’Loading’).style.visibility = “visible”;
\$(’statusMsg’).innerHTML = s;
setTimeout( “\$(’Loading’).style.visibility = ‘hidden’;”, n );
}
function getRequest(form) {
var value = form.value.value;
var mgmt_server = form.mgmt_server.value;
var search_on = form.search_on.value;
var ignore_case = form.ignore_case.value;
var browser = form.browser.value;
var action = form.action.value;
setStatus(’Processing request…’, 1500);
ajaxEngine.sendRequest( ‘getRequest’,
“value=” + value,
“mgmt_server=” + mgmt_server,
“search_on=” + search_on,
“ignore_case=” + ignore_case,
“browser=” + browser,
“action=” + action );
}
function loadTemplate(mgmt_server,view,value) {
ajaxEngine.sendRequest( ‘getRequest’,
“mgmt_server=” + mgmt_server,
“view=” + view,
“value=” + value );
}
onloads.push( registerAjaxRequest );
function ShowHide(id) {
obj = document.getElementsByTagName(”div”);
if (obj[id].style.visibility == ‘visible’) {
obj[id].style.visibility = ‘hidden’;
} else {
obj[id].style.visibility = ‘visible’;
}
}
Recent Comments