I have a common toolbar in my jsp page. I have multiple buttons like add ,edit , close,list on it.
When I click on the add button present on the toolbar my edit and list button should get disabled or become hidden. How can I do it. Please provide the code for the same.
my code is
function doOnLoad(frm)
{
document.getElementById('subModId').value = '<%=request.getParameter("subModId")%>';
document.getElementById('jspPageName').value = '<%=request.getParameter("jspName")%>';
dhxToolbar = new dhtmlXToolbarObject("toolbarObj");
dhxToolbar.setIconsPath("<%=UIAttributes.APP_PATH%>/web/images/toolBarImgs/");
dhxToolbar.loadXML("<%=UIAttributes.APP_PATH%>/generic.htm?action=viewToolbar&subModId="+document.getElementById('subModId').value);
dhxToolbar.attachEvent("onClick", function(id){
toolBarClicked(id);
} );
}
function toolBarClicked(ab)
{
//alert("the toolbar id is "+ab);
var text = dhxToolbar.getItemText(ab);
if(text=="Add")
{
var id = dhxGrid.getSelectedId();
var submoduleId;
if(id!=null)
{
submoduleId= dhxGrid.cells(id,2).getValue();
alert("the value of submodule Id is "+submoduleId);
}
else
{
submoduleId="null";
//alert("the value of section Id is "+sectionId);
}
var frm=document.submitFrm;
frm.action="<%=UIAttributes.APP_PATH%>/master.htm?action=viewSubModule&submoduleId="+submoduleId;
frm.submit();
}
if(text=="Edit")
{
var id = dhxGrid.getSelectedId();
var submoduleId;
if(id!=null)
{
submoduleId= dhxGrid.cells(id,2).getValue();
//alert("the value of submoduleId is "+ submoduleId);
}
else
{
alert("Please select AtLeast One SubModule to Edit");
return;
}
var frm=document.submitFrm;
frm.action="<%=UIAttributes.APP_PATH%>/master.htm?action=viewSubModule&submoduleId="+submoduleId;
frm.submit();
}
if(text=="Delete")
{
var id = dhxGrid.getSelectedId();
var cntr = dhxGrid.getRowsNum() ;
var cntval=0;
for(i=1;i<=cntr;i++)
{
var chkdVald = dhxGrid.cells(i,1).isChecked();
if(chkdVald == true)
{
cntval = cntval + 1;
}
}
if(cntval > 0)
{
if(confirm("Are you sure you want to delete these Records?"))
{
for(i=1;i<=cntr;i++)
{
var chkdVal = dhxGrid.cells(i,1).isChecked();
if(chkdVal==true)
{
var s = dhxGrid.cells(i,2).getValue();
subModuleService.deleteSubModule(s,returnDelSubModuleList);
}
}
}
else
{
return;
}
}
else
{
alert("Select at least one SubModule Id to delete!!!");
return;
}
}
if(text=="Close")
{
parent.dhxWins.window("window").close();
}
}//end of toolbar clicked
My question is onload of the jsp page all the buttons on the toolbar should be displayed and enabled and when i click on the add button ,the list button should be disabled how to do it.
Rama