[mochikit] How prevent mochikit from html entity decode of sortable data?

2007-06-16 Thread tired

I have used the 'mochikit sortable' table to sort data (loading a json
file through ajax). In that table one of columns has linked data which
htlml entity decoded by mochikit, so it show raw html instead link.
For example, I supplied the data like

a href=drink-details.php?drink_id=153Red Wine Glass: Use for red
or white wine (if you don't have a white wine glass), or water./a

But mochikit show it like,

lt;a href=drink-details.php?drink_id=153gt;Red Wine Glass: Use for
red or white wine (if you don't have a white wine glass), or
water.lt;/agt;

That is it decode the '' and '' to 'lt' and 'gt'.

Anybody help me how to prevent this type decoding?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: How prevent mochikit from html entity decode of sortable data?

2007-06-16 Thread Bob Ippolito

On 6/15/07, tired [EMAIL PROTECTED] wrote:

 I have used the 'mochikit sortable' table to sort data (loading a json
 file through ajax). In that table one of columns has linked data which
 htlml entity decoded by mochikit, so it show raw html instead link.
 For example, I supplied the data like

 a href=drink-details.php?drink_id=153Red Wine Glass: Use for red
 or white wine (if you don't have a white wine glass), or water./a

 But mochikit show it like,

 lt;a href=drink-details.php?drink_id=153gt;Red Wine Glass: Use for
 red or white wine (if you don't have a white wine glass), or
 water.lt;/agt;

 That is it decode the '' and '' to 'lt' and 'gt'.

 Anybody help me how to prevent this type decoding?

It's not decoding anything, the DOM works with nodes not markup. Text
turns into text nodes.

In order to turn literal HTML into a DOM node you'll have to use
something like this:

function htmlDiv(htmlText) {
var s = DIV();
s.innerHTML = htmlText;
return s;
}

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: How prevent mochikit from html entity decode of sortable data?

2007-06-16 Thread tired

Hi bob,
Thanks for your reply. Please check the following javascript code:

for (var i = 0; i  sortableManager.rows.length; i++) {
var row = sortableManager.rows[i];
var domain = {};
json_item = row[ind].toLowerCase();
if ( json_item.indexOf(search_item) = 0 
( json_item.indexOf(search_item) == 0 ||
json_item[json_item.indexOf(search_item)-1] == ' ') )
{
for (var j = 0; j  
sortableManager.cols.length; j++) {
   if ( j == 1 )
domain[sortableManager.cols[j]] 
= 'a href=drink-details.php?
drink_id='+row[0]+''+row[j]+'/a';
  else
domain[sortableManager.cols[j]] 
= row[j];
  }
domains.push(domain);
}
}
sortableManager.data.domains = domains;

Here I've pushed (insert) the row (for table) of data
(domains.push(domain);). The first column of table is a linked data,
which is show after decode. But I did not do any decoding in my
projects. Data are fetched from a json file (row). Have you any
suggestion. Eagerly waiting for your reply.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---