:: Forum >>

Please help me with dynamic data loading.....

Hi All

I went through the forum for the above topic, I found many entries, but I have some specific question on this dynamic data loading. Here is my HTML Code.
======================================================
<%@ Language=VBScript %>
<% Response.Buffer=True %>
<% Response.Expires = 0 %>
<html>
<head><title></title>
<LINK REL=STYLESHEET TYPE="text/css" HREF="/RGA_New/css/Royal.css">
<LINK REL=stylesheet TYPE="text/css" href="/RGA_New/runtime/styles/xp/grid.css"></link>
<script src="/RGA_New/source/lib/grid.js"></script>
<script src="/RGA_New/runtime/lib/paging1.js"></script>
<SCRIPT LANGUAGE="JavaScript" SRC="/RGA_New/js/RoyalCommon.js"></SCRIPT>
    <style>
        .active-controls-grid {width: 1080; height: 500; font: menu; background-color: #FFFFFF;}
        .active-column-0 {width: 50px;}
        .active-column-1 {width: 80px;}
        .active-column-2 {width: 200px;}
        .active-column-3 {width: 250px;}
        .active-column-4 {width: 50px;}
        .active-column-5 {width: 180px;}
        .active-column-6 {width: 80px;}
        .active-column-7 {width: 80px;}
        .active-column-0 {text-align: left;}
        .active-column-1 {text-align: left;}
        .active-column-2 {text-align: left;}
        .active-column-3 {text-align: left;}
        .active-column-4 {text-align: right;}
        .active-column-5 {text-align: left;}
        .active-column-6 {text-align: left;}
        .active-column-7 {text-align: left;}

        .active-grid-column {border-right: 1px solid threedlightshadow;}
        .active-grid-row {border-bottom: 1px solid threedlightshadow; height: 20px;}
    
</style>

</head>
<body>
<TABLE>
<TR><TD CLASS="Label">Repair&nbsp;Quote#:</TD>
<TD CLASS="Label"><INPUT FORMNAME="REPAIR" CLASS="Text" TYPE=TEXT ID="logid" SIZE=20 NODISABLE='Y'>&nbsp;&nbsp;<img src="/RGA_New/imgs/ico_go.gif" border=0 onclick="javascript:Form_FetchData(document.all.logid.value);"></TD></TR>
<tr><td><span id=message></span></td></tr>
</TABLE><BR>
<DIV id="GridDiv">
<script>
    var list_columns=["Quote#","Date","Name","Comments","Qty","Quote Type","Quote Date","Status"];

objRepair = new Active.Controls.Grid;
    //objRepair.setId("G1");
     objRepair.setColumnProperty("count", 8);
     objRepair.setColumnProperty("text", function(i){return list_columns[i]});
     document.write(objRepair);
</script>
</DIV>
<SCRIPT LANGUAGE="JavaScript" SRC="/RGA_New/js/Repair.js"></SCRIPT>
</body>
</html>
======================================================
Here is my js file
=====================================================
function Form_Load() {
try {
//create_gridobj()
Form_FetchData();

} catch(e) {
alert("Repair.js:Form_Load - Error: (" + e.description + ")");
}
}

function Form_FetchData() {
try {
     var url="/RGA_New/xml/Listdata.asp?sid=" + Math.random();
var result=[b]GetXMLData(url);[/b]
     var sdata=result.split("|");
     [b]var listdata=[sdata[1]];[/b]
     objRepair.setDataProperty("count",sdata[0]);
     [b]objRepair.setDataProperty("text",function(i,j){return listdata[i][j]});[/b]
     objRepair.refresh();
} catch(e) {
alert("Repair.js::DataRequest - Error: (" + e.description + ")");
}
}

function create_gridobj() {
    var list_columns=["Quote#","Date","Name","Comments","Qty","Quote Type","Quote Date","Status"];

objRepair = new Active.Controls.Grid;
    //objRepair.setId("G1");
     objRepair.setColumnProperty("count", 8);
     objRepair.setColumnProperty("text", function(i){return list_columns[i]});
     document.write(objRepair);
}
window.onload = Form_Load;
=====================================================
I want to populate the data returned by the GetXMLData function, which in turn calls a ASP page using HTTPRequest.
The data returned by HTTPRequest in a array with delimiter "|". I split it in the js file and taking the first element aND assignign to the row count.
The second element in the array is the data, which is returned in the following format.
["12345","3/16/2006","ABC","This is test","1","DealerQuote","3/16/2006","Quoted"].
and assigned to the listdata variable.

Now my question is how do I set the data to the grid.
"objRepair.setDataProperty("text",function(i,j){return listdata[i][j]});"
The above statement is returning an error "listdata[...] is null or not an object".

I will appreciate if some one in this forum can help solving the problem. I am struggling to get the basic grid working for more than a week.

Thanks in advance
prao

Thursday, March 16, 2006
It looks like the row count does not match the number of rows in array for some reason. Could you add try/catch into the data function (function(i,j){return listdata[i][j]}) and check values for i, j when there is an error?
Alex (ActiveWidgets)
Thursday, March 16, 2006
Hi Alex

As you mentioned, problem is with the row count. I tried to just return one row, but the problem is, where do I create the array.
Whether on the server side program or in the js file.
The data returned from the server looks like this
[["12286", "3/8/2006", "Gunline Tools", "Customer will send closer after replacement ships. A=17-22/32, F=flush b1=1.6125. Wants 16001 also\r\nNardini TT1030", "1", "RLNoNDealerQuoteNew.rpt", "3/8/2006", "New", ], ]

When I assign the data to the variable listdata, I get the same error "listdata[...] is null or not an object".

Can you help me fix this problem.

Thanks
Regards
prao
Friday, March 17, 2006
Some suggestions -

- remove the comma after your last array element

- try listdata = sdata[1]; instead of [sdata[1]]

- put error check inside data text function

function textfunc(i, j){
try {
return listdata[i][j];
}
catch(err){
alert("error, i=" + i + " listdata.length=" + listdata.length);
}
}

objRepair.setDataProperty("text", textfunc);
Alex (ActiveWidgets)
Friday, March 17, 2006
Hi Alex

I followed your suggestions and made the changes. I removed the square brackets from sdata[1] and inserted the function textfunc,
the textfunc is returning an error
"error i=0 listdata.length=256" and the grid column is filled with word
"undefined"

Any further help will be appreciated.

Thanks

Regards
prao
Sunday, March 19, 2006
Hi

Any help on with my problem.

prao
Sunday, March 19, 2006

This topic is archived.


Back to support forum

Forum search