WebScheduler - About Car Rental Management Sample

5 replies. Last post: January 4, 2011 9:43 PM by Handy Surya
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hello,

I am studying your Car Rental Management sample for WebScheduler at http://live.intersoftpt.com/cs/WebScheduler/CarRental.aspx?noframe=1&path=/WebScheduler/New%20Features%20in%20V3/New%20Reference%20Samples 

If you happen to delete a row in the sql database Resources table, for example row No. 3 (Nissan Versa), a javascript error will be thrown when you click on the small info button for Honda Fitz (row No. 4), because the script (DetailClick) is looking for the deleted row 3 but cannot find it.  Furthermore, after this gap in the rows, the detailed information displayed when you click the small info button will be thrown out of sequence for all cars.

Can you modify the portion of the javascript involved (shown below), so that there is no error when there are gaps caused by missing rows in the database, and so that the car info is kept in sequence after any gap in the rows.

Regards

Jean

 

function WebScheduler1_OnInitialize(controlId)

{

var s = ISGetObject(controlId); var table = s.GetResourcesTable(); var rows = table.rows; for (var i = 1; i < rows.length; i++)

{

var cell = rows[i].cells[1]; var div = cell.children[0].children[0]; var str = "<img id='detail" + i + "' src='./images/detail.gif' type='detail' style='margin-left: 5px; cursor: pointer;' title='Click here to show detail'>" var temp = document.createElement("DIV");

temp.innerHTML = str;

div.appendChild(temp.children[0]);

}

Listener.Add(table,
"onclick", DetailClick);

}

 

function DetailClick()

{

var el = event.srcElement; if (el.attributes["type"] && el.attributes["type"].value == "detail")

{

var id = el.attributes["id"].value.split("detail")[1]; var s = ISGetObject("WebScheduler1"); var resource = s.GetResourceById(id); var img = document.getElementById("detailImage"); var desc = document.getElementById("detailDescription"); img.src = "./images/" + id + ".jpg";

desc.innerHTML = resource.Description.replace(/, /gi, "<br /><br />");

}

}

All times are GMT -5. The time now is 11:19 AM.
Previous Next