Julius
Posts: 6
|
| Posted: 12/01/2006, 3:45 AM |
|
Hello
I would like to substitute the 'CheckBox_Delete' in a editable grid with 2 icons eg. wastebin on and off.
I tried to substitute it with a button control and other solutions. I don't get anywhere.
Is there any hint how to proceed.
Thanx for help.
Julius
|
 |
 |
Julius
Posts: 6
|
| Posted: 12/04/2006, 8:20 PM |
|
Hi
seems like nobody has any clue how to do this.
I would like to get feedback if this is really the most straight forward way to do it.
I would like to send a screenshot, but there doesn't seem to be a possibility to upload a jpg.
I found some functions in the 'function.js', they seem to have a similiar purpose, but somehow I couldn't figure them out.
Some documentation would help!
Anyway I found a solution and I would like to discuss it.
Thank for your feedback.
Julius
**********************************************************************
// A set of functions to replace the 'CheckBox_Delete' control with a toggle button
// Don't delete the 'CheckBox_Delete' control
// It just should be made invisible
// Fx: assign a css style to the button -> class="invisible"
// .invisible {
// background-color: transparent;
// border: none;
// border-style: none;
// height: 0;
// width: 0;
// margin: 0;
// text-align: right;
// visibility: hidden;
// }
// This is how it gets put in action
// var myform="form1";
// var btn=this;
// var pic1="url(Styles/{CCS_Style}/Images/recycler.gif)";
// var pic2="url(Styles/{CCS_Style}/Images/recycler__h.gif)";
// var chkboxname="CheckBox_Delete";
// btnDelRowEdGrid(btn,pic1,pic2,chkboxname,myform);
function rowindex(btnname)
// This function extracts the index of the row
// btnname -> the name of the button control
{
var i;
i = btnname.indexOf("_");
while (i > 0) {
btnname = btnname.substr(i);
i = btnname.indexOf("_");
}
return btnname;
}
function togglebutton(btn,pic1,pic2)
// This function changes the picture of the button
// btn -> the button object
// pic1 -> name and path of the original background picture of the button
// pic2 -> name and path of the swapped background picture of the button
{
if (btn.value=="") {
btn.style.backgroundImage=pic2;
btn.style.backgroundRepeat="no-repeat";
btn.value=" "; //set an empty string to the value of the button
}
else
{
btn.style.backgroundImage=pic1;
btn.style.backgroundRepeat="no-repeat";
btn.value=""; //set a 'space' string to the value of the button
}
}
function togglechkbox (myform,mychkbox,btn)
// This function toggles 'checked' - 'unchecked'
// myform -> name of the editable grid form
// mychkbox -> name of the checkbox
// btn -> the button object, default 'this'
//
{
var delctl=document.forms[myform].elements[mychkbox] //define the form object
if (btn.value==" ") {
delctl.checked=1; // set the checkbox
}
else {
delctl.checked=0;
}
}
function btnDelRowEdGrid(btn,pic1,pic2,chkboxname,myform)
// this function triggers these functions:
// rowindex, togglebutton, togglechkbox
// create a button in the row of a editable grid with a 'CheckBox_Delete' control
// assign a value to this button like '1' NOT '0'
// Create the 'OnClick' event of the button
// Copy the functions to the 'OnClick' event of the button
//
// btn -> the button object, default 'this'
// pic1 -> name and path of the original background picture of the button
// pic2 -> name and path of the swapped background picture of the button
// chkboxname -> name of the checkbox control, default 'CheckBox_Delete'
// myform -> name of the editable grid form
{
var thisctlname = btn.name;
var myindex = rowindex(thisctlname); //extract the rowindex
var chkboxname=chkboxname+myindex; //set the name of the checkbox
togglebutton(btn,pic1,pic2); //change th background pics of the button
togglechkbox (myform,chkboxname,btn); //set the 'checked' value of the checkbox
}
|
 |
 |
|