function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gmc74gmc74 

S-Control runs in Firefox, but not in Internet Explorer

Hi Everyone,
 
I created an S-Control with the AJAX Tools 1.4
 
Code:
<html>
<!--
Generated by AJAX tools
Date : Thu Jan 17 2008 15:58:00 GMT-0700 (US Mountain Standard Time)
Template : listview.html by manoj@cheenath.com
SControl : CaseTestSControl
-->

<html>

<head><title>listview</title>

<link rel="shortcut icon" href="/favicon.ico"/>
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/js/dojo/0.3.1/dojo.js"></script>
<title>CaseTestSControl</title>

<style>
table {
font-family: Lucida Grande, Verdana;
font-size: 0.8em;
width: 100%;
border: 1px solid #ccc;
cursor: default;
}

* html div.tableContainer {
/* IE only hack */
width: 95%;
border: 1px solid #ccc;
height: 285px;
overflow-x: hidden;
overflow-y: auto;
}

table td,
table th {
border-right: 1px solid #999;
padding: 2px;
font-weight: normal;
}

table thead td, table thead th {
background: #94BEFF;
}

* html div.tableContainer table thead tr td,
* html div.tableContainer table thead tr th {
/* IE Only hacks */
position: relative;
top: expression( dojo.html.getFirstAncestorByTag(this, 'table').parentNode.scrollTop-2);
}

html>body tbody.scrollContent {
height: 262px;
overflow-x: hidden;
overflow-y: auto;
}

tbody.scrollContent td, tbody.scrollContent tr td {
background: #FFF;
padding: 2px;
}

tbody.scrollContent tr.alternateRow td {
background: #e3edfa;
padding: 2px;
}

tbody.scrollContent tr.selected td {
background: yellow;
padding: 2px;
}

tbody.scrollContent tr:hover td {
background: #a6c2e7;
padding: 2px;
}

tbody.scrollContent tr.selected:hover td {
background: #ff3;
padding: 2px;
}
</style>

<script type="text/javascript">
dojo.require("dojo.widget.SortableTable");
dojo.addOnLoad(displayTable);


function displayTable() {
var query = "Select " +
"Id,CaseNumber,Status,Remaining__c,Route_To_User__c,Route_To_Group__c" +
" from Case where Status = 'New' ORDER BY Remaining__c";

var result = sforce.connection.query(query);

var sb = new sforce.StringBuffer();
sb.append("<tr>");
sb.append("<td>No</td>");

sb.append("<td>Id</td>");

sb.append("<td>CaseNumber</td>");

sb.append("<td>Status</td>");

sb.append("<td>Remaining__c</td>");

sb.append("<td>Route_To_User__c</td>");

sb.append("<td>Route_To_Group__c</td>");

sb.append("</tr>");

while (true) {
if (result.size > 0) {
for (i = 0; i < result.records.length; i++) {
var record = result.records[i];
sb.append("<tr><td>").append(i).append("</td>");

sb.append("</td><td> ").append(editLink(record, "Id"));

sb.append("</td><td> ").append(editLink(record, "CaseNumber"));

sb.append("</td><td> ").append(editLink(record, "Status"));

sb.append("</td><td> ").append(editLink(record, "Remaining__c"));

sb.append("</td><td> ").append(editLink(record, "Route_To_User__c"));

sb.append("</td><td> ").append(editLink(record, "Route_To_Group__c"));

sb.append("</td></tr>");
}
}
if (result.done == "true") {
break;
} else {
result = sforce.connection.queryMore(result.queryLocator);
}
}
document.getElementById("list-view-table").innerHTML = sb.toString();
}


function editLink(record, field) {
var value = record[field];
value = value — value : "&nbsp;";
return value;

//todo: edit link
return "<a href='javascript: editCell(\"" + record.Id +
"\",\"" + field + "\",\"" + value + "\")'>" +
value + "</a>";
}


function editCell(id, field, value) {
var newVal = prompt("Enter new text", value);
if (newVal === null || newVal === value) {
alert("Field not changed");
return;
} else {
value = newVal;
}
var record = new sforce.SObject("Account");
record.Id = id;
record[field] = value;

try {
result = sforce.connection.update([record]);
if (result[0].getBoolean("success") == false) {
alert("update failed");
} else {
//initPage();
}
} catch (e) {
alert("update failed");
//sforce.debug.display(e);
}
}
</script>
</head>

<body>
<div class="tableContainer">

<table dojoType="SortableTable" id="list-view-table"
headClass="fixedHeader" tbodyClass="scrollContent"
enableMultipleSelect="true" enableAlternateRows="true"
rowAlternateClass="alternateRow" cellpadding="0" cellspacing="0" border="0">
</table>
</div>

</body>
</html>

 
The S-Control does what I want it to, but it won't display in Internet Explorer, only in Firefox.  If it were up to me, that would be fine, unfortunately my company is a Microsoft Partner so it won't fly.
 
Any ideas?  The error is an unknown run time error and the URL is that of the S-COntrol
 
Thanks
 
Grant
gmc74gmc74
Has no one else had this issue?
MigMig
Hi,

Lookup to your dojo functions, I used Dojo sometimes but I had a lot of problems in IE :( You need to lookup to the compatibility in the Dojo site of your functionnalities calls ... and if u really want to make that work in IE, it could be impossible ( it depends ... the dojo table has some problems ... ) !!!! Even if it's ok to IE 6 ... the IE 7 can have some problems ... so u have to test both ...

Dojo is great but only for FF ... :(

If this does not solve your problem ( even if I'm almost sur of it ... )  ... lookup to your DOM attributes ! IE has a lot of differents components like Class(FF) and ClassName (IE)  ...

Rgds,
Mig


Message Edited by Mig on 01-21-2008 08:44 AM

Message Edited by Mig on 01-21-2008 08:47 AM
gmc74gmc74
Thank you, I will definitely do that!

Thanks for the starting point!
gmc74gmc74
I couldn't find the issue, so I scrapped it and re-wrote it by hand.  That did the trick, for some reason I think it was in the code for the table, but I can't be sure of that.

All is well now, thanks for the help.
MigMig
Happy to read it.

It's funny because, it's always the solution I found for the Dojo problems .. :(

Chears ...

Mig