Hi
I don't know if this is the right place to post my problem.
I m new to YUI, I ve modified the exemple listed here
http://developer.yahoo.com/yui/examples/datatable/dt_enhanced_clean.html
well, FireFox and Opera diplay what I want, but as always the IE drive me nut, and this time IE7/IE6 gives me errors,
I did few changes

...
<body class=" yui-skin-sam">
<div id="markup">
<table id="[B]ex[/B]" >
<thead>
<tr>
<th>Name</th>
<th>city</th>
<th>Viseted</th>
<th>Date</th>
<th>Otption</th>
</tr>
</thead>
<tbody>

<tr>
<td>[B]<a href="#nogo">roja</a[/B]></td>
<td>[B]marbella[/B]</td>
<td>[B]418[/B]</td>
<td>[B]08/08/2008[/B]</td>
<td>[B]<a href="#nogo"><b>add</b></a>[/B]</td>
</tr>
</tbody>

</table>
</div>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.EnhanceFromMarkup = new function() {
var myColumnDefs = [
[B]{key:"name",label:"Name",sortable:true},
{key:"city",label:"City", sortable:true},
{key:"visited",label:"Visited",sortable:true},[/B]

[B]{key:"date",label:"Date",formatter:YAHOO.widget.DataTable.formatDate,sortable:tr\
ue},
{key:"option",label:"Option",sortable:false},[/B]

];


this.myDataSource = new
YAHOO.util.DataSource(YAHOO.util.Dom.get("[B]ex"[/B]));
this.myDataSource.responseType =
YAHOO.util.DataSource.TYPE_HTMLTABLE;
this.myDataSource.responseSchema = {
[B]fields: [
{key:"name"},
{key:"city"},
{key:"visited"},
{key:"date",parser:YAHOO.util.DataSource.parseDate},
{key:"option"},
][/B]
};

this.myDataTable = new YAHOO.widget.DataTable("markup",
myColumnDefs, this.myDataSource,
{sortedBy:{key:"date",dir:"desc"}});
};

});
</script>
...

I ve spent the whole day trying to fix the error, Can you point me to the error?
thanks.

Recommended Answers

All 3 Replies

Asking your question in the official YUI forum/newsgroup would be more beneficial IMO since almost everyone here uses his/her choice of Javascript library.

I asked my question there, and I got the answer

Don't put that last comma in the column definitions and fields arrays.
Instead of ignoring it, IE assumes an extra undefined element in the array,
after the comma, so it reports the length of the array one element longer
than it should, making many loops fail.

Satyam

thanks for your reply :)

Glad I could point you in the right direction. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.