:: Forum >> Version 2 >>

add extra columns with image after xml dat load

I want to add extra columns for edit and delete. I have the code to retrieve the dat from the xml file.
But need to add extra columns which have images edit & delete

I tried by implementing the code below, But failed.

Help me out with the exact code

<html>
<
head>

    <
title>ActiveWidgets Example</title>
    <!-- 
ActiveWidgets stylesheet and scripts -->
<
META http-equiv=Content-Type content="text/html; charset=windows-1252">    
<
STYLE>BODY {    
    
PADDING-RIGHT0pxPADDING-LEFT0pxPADDING-BOTTOM0pxMARGIN0pxOVERFLOWhiddenPADDING-TOP0px    
}    
HTML {    
    
PADDING-RIGHT0pxPADDING-LEFT0pxPADDING-BOTTOM0pxMARGIN0pxOVERFLOWhiddenPADDING-TOP0px    
}    
</
STYLE>    
<
link href="basic_files/aw.css" rel="stylesheet" type="text/css" ></link>
    <
script src="basic_files/aw.js"></script>
<
STYLE>
.
aw-grid-control {

    
BORDER-RIGHTmedium none
    
BORDER-TOPmedium none
    
MARGIN0px
    
FONTmenu
    
BORDER-LEFTmedium none
    
WIDTH100%; 
    
BORDER-BOTTOMmedium none
    
HEIGHT100%;
}

.
aw-row-selector {

    
TEXT-ALIGNcenter

}

.
aw-column-{

    
WIDTH80px

}

.
aw-column-{

    
WIDTH200px

}

.
aw-column-{

    
TEXT-ALIGNright

}

.
aw-column-{

    
TEXT-ALIGNright

}

.
aw-column-{

    
TEXT-ALIGNright

}

.
aw-column-{

    
TEXT-ALIGNcenter

}

.
aw-column-{

    
TEXT-ALIGNcenter

}

.
aw-grid-row {

    
BORDER-BOTTOMthreedlightshadow 1px solid

    font
-familyArialHelveticasans-serif;
    
font-size10pt;
}

.
aw-alternate-even {

    
BACKGROUND-COLOR#ECECE4
}


.
aw-header-.aw-item-box 
{
    
font-size9pt;
    
font-weightnormal;
    
text-align center;
    
color#000000;
    
background#CCCCCC;
    
border-left1px solid ThreeDHighlight;

}
.
aw-rows-selected background#B4B4DBcolorblack; }
.
aw-grid-cell {border-left1px solid ThreeDHighlight;}
.
aw-row-selector{background:#fffffftext-alignleft;} 
.
aw-alternate-even .aw-row-selector .aw-item-box 
    
background#ECECE4

.
aw-rows-selected .aw-row-selector .aw-item-box 
    
background#B4B4DB
}

.
aw-row{
    
font-familyArialHelveticasans-serif;
    
font-size20pt;
}
 .
aw-header-.aw-grid-sort {
    
display:-moz-inline-box;
    
top:-2px
}
 .
aw-sort-ascending .aw-grid-sort {
    
background:url(grid.png) -25px -5px
}

 .
aw-sort-descending .aw-grid-sort {
    
background:url(grid.png) -45px -5px
}
.
aw-header-.aw-mouseover-header {
    
BACKGROUND#ccccccBORDER-BOTTOM-COLOR#f9b119
}
.
aw-header-.aw-mouseover-header .aw-item-box {
    
BACKGROUND#ccccccBORDER-BOTTOM-COLOR#f9a900
}

</
STYLE>
<!-- 
grid data -->    
<
SCRIPT>
        var 
myColumns = [
            
"Ticker""Company Name""Market Cap.""$ Sales""Employees""Edit""Delete"
        
];
</
script>    
    

<
META content="MSHTML 6.00.2900.2802" name=GENERATOR>
</
head>
<
body>
<
div id="1" style="width:930px;height:200px;overflow:auto">

<
script>

    var 
table = new AW.XML.Table;
    
table.setURL("companies-simple.xml");
    
table.request();

    var 
obj = new AW.Grid.Extended;
    var 
str = new AW.Formats.String;
    var 
num = new AW.Formats.Number;

    
obj.setCellModel(table);
    
obj.setRowCount(20);
    
obj.setColumnCount(7);
    

    
obj.setCellFormat([strstrnumnumnum]);

    
//    provide cells and headers text
    //obj.setCellText(myData);
    
obj.setHeaderText(myColumns);

    
//    set number of rows/columns

    //    enable row selectors
    
obj.setSelectorVisible(true);
    
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});

    
//    set headers width/height
    
obj.setSelectorWidth(28);
    
obj.setHeaderHeight(20);

    
obj.setCellEditable(false);

    
obj.setFixedLeft(1);
    
obj.setVirtualMode(false);

    
obj.setSelectionMode("single-row");
    
//obj.setCellLink(function(i, j){ return "http://www.mysite.com?i="+i+"&j="+j; }, 5);    // set data  
    //obj.setCellTemplate(new AW.Templates.Link, 5);    // and template  
    //obj.setCellLink(function(i, j){ return "http://www.mysite.com?i="+i+"&j="+j; }, 6);    // set data  
    //obj.setCellTemplate(new AW.Templates.Link, 6);    // and template  
    
for (var i=0i<obj.getRowCount(); i++)
    {
        
obj.setCellText("<img src='editicon.gif' BORDER='0'>"5i);
        
obj.setCellTooltip("Edit",5,i);  
        
obj.setCellText("<img src='delicon.gif' BORDER='0'>"6i);  
        
obj.setCellTooltip("Delete",6,i);  
    }

    
document.write(obj);
    
obj.setSelectedRows([5]);     
    
obj.setCurrentRow(5-4); // -4 = rownumber of the selected row when autoscroll

</script>
</
body>
</
html>

 
SS
Tuesday, April 25, 2006



This topic is archived.

Back to support forum

Forum search