3.0.0

problem in loading image when loaded data from the xml file

I have loaded the data from the xml file.
I want to add edit and delete images in the each row.
I have implemented the code, but the after the data gets loaded from the xml file the image disappears.
I think it get refreshed, coz when i comment the xml data display code, the images seems to display.
Please let me know how to cope with this problem.
IM SUBMITTED THIS QUERY 4-5 TIMES BUT NO ONE REPLIED ME.
Please help me. Its very very urgent.

Thanks.

Here is my 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-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; OVERFLOW: hidden; PADDING-TOP: 0px    
}    
HTML {    
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; OVERFLOW: hidden; PADDING-TOP: 0px    
}    
</STYLE>    
<LINK href="basic_files/aw.css" type=text/css rel=stylesheet></LINK>
<LINK href="basic_files/master.css" type=text/css rel=stylesheet></LINK>
<SCRIPT src="basic_files/aw.js"></SCRIPT>    
<!-- grid format -->    
<!-- 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:800px;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.setRowCount(20);
    obj.setColumnCount(7);
    

    obj.setCellFormat([str, str, num, num, num]);

    //	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(true);

    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  
    obj.setCellModel(table);

    for (var i=0; i<obj.getRowCount(); i++)
    {
        obj.setCellText("<a target='_blank' href='#'><img src='editicon.gif' BORDER='0' alt='Edit'></a>", 5, i);
        obj.setCellText("<a href='#'><img src='delicon.gif' BORDER='0'></a>", 6, i);  
    }

    document.write(obj);
    //alert(obj.getRowCount());
    obj.setSelectedRows([5]); 	
    obj.setCurrentRow(5-4); // -4 = rownumber of the selected row when autoscroll
//alert(obj.getRowCount());
</script>
</body>
</html>
Sanjay Sharma
April 28,
Sanjay,

sorry, I saw your previous posts but could not find out what is wrong. I think I understand now.

When you attach the external data source (AW.XML.Table) it replaces the internal data which you set with setCellText method. If you want to combine the data coming from the XML file with some local data - you have to do it in the external table object -

// save default getData() method
    table.getData1 = table.getData;
    
    // replace getData() method with new one
    table.getData = function(col, row){

        if (col == 5){
            return "<img src=\"icon.gif\">";
        }

        return this.getData1(col, row);
    }
Alex (ActiveWidgets)
April 28,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.