| Page 2 of 2 | [ 14 posts ] | Go to page Previous1, 2 |
|
Thanks Todd, but this doesn't work any differently. It's a different implementation but I'm getting the same result.
I actually use Local XML in my non-WordPress projects when retrieving datasource information. But as I began to learn how to develop within the WordPress environment I had problems figuring out how to replicate the same tasks. Eventually, I found information on how to use the WP database and was led to the jQuery implementation that you noticed in the code (very little info exists online on using YUI within WP). Since then, I've created a number of datatables using jQuery to retrieve and load data within WP with no problems. This has been solely used for building admin tools and not attempted on the front-end until now. Also, I had never had to pass HTML from the database to a datatable either. So the jQuery ajax call works, including in this example. But I can't say that it's responsible for strip the HTML tags since it's happening with your implementation as well. I actually think YUI is responsible for that. The two records and one column output you're getting is accurate. It's all part of the HTML and design of the page being created. Essentially, the information will mimic a blog in style. I'm using a datatable to display the preview for different press articles and the paginator will help scroll through the list. The one issue holding this up from completion is the disappearing HTML tags. A couple of questions that may help us find a solution: 1. Can you insert HTML into a datatable table cell? 2. Can you insert HTML into a datatable strictly from a datasource? 3. Are there examples of a datatable being used in this manner? The obvious answer to #1 is "yes" as I'm able to insert it through innerHTML. But I can't figure out #2 because the content being passed through XML is being stripped of HTML tags in the datasource before it reaches the datatable. But when and where? |
|
Quote: But I can't say that it's responsible for strip the HTML tags since it's happening with your implementation as well. This is not true, I did see ALL of the HTML content in the datatable I did not see any "stripping of HTML". Let me answer the last 3 questions you posted; 1. Can you insert HTML into a datatable table cell? Absolutely, we do it all the time. 2. Can you insert HTML into a datatable strictly from a datasource? Yes, any type of DS 3. Are there examples of a datatable being used in this manner? One good example is Satyam's nested DataTable, shows a DataTable in Cells of another DataTable link is http://www.satyam.com.ar/yui/2.8.0/nested1.html I suspect you may be encountering a CSS block element vs inline element type of issue. You are aware that there is some HTML content that will not render in an HTML TABLE properly, correct? Have you attempted to insert "your HTML" completely into plain HTML <table> and seen satisfactory results? Attempt this on a test file without any YUI libraries loaded. As for your question, where is DataSource "stripping" out the HTML (of which I disagree it is stripping anything), DataSource applies the this.parseXML method when the data payload is returned, that is where XML parsing takes place. This thread is getting a little long. If you want fresh eyes on this, I suggest you re-post a new topic on YUI 2.x DataTable with a title of something like "XML DataTable importing HTML content" or something like that. Maybe new eyes can you get around this one. Good Luck, Todd |
|
So after stepping away from this problem for a couple days I have found a solution. Part of the process of creating the datatable is generating the XML that feeds the datasource. Essentially, a function queries the WP database and creates the resulting XML. Well, within this function I wondered what would happen if I used the htmlentities function to convert HTML tags into HTML entities (i.e. "<p>" becomes "<p>"). Guess what ... it worked! Now within the XML you will notice that all HTML tags were converted and they remained untouched when the datatable is rendered. That wasn't the case before. The problem may still have resided somewhere within my code and not YUI, like I presumed, but now that my problem is solved that's all that matters.
I understand your stance that YUI doesn't strip HTML because it has worked for you. My experience, at least with this problem, was different. But at least I have found a workaround. When this page goes to the live server for testing I'll post the link so you can see what I've been looking at. Perhaps you can spot something that I've been doing wrong with my implementation and I can avoid using this workaround in the future. Either way, I've very grateful for your help. |
|
Another point is the XML approach requires very careful treatment of non-HTML character entities (for example " " needs to be entered in numeric as " "). Also the content needs to be assured to be well-formed when using YUI with XML.
This is one reason why I use JSON, it is quite a bit more forgiving -- just not sure what will happen when HTML5 become commonplace. Glad you appear to be working okay. Todd |
| Page 2 of 2 | [ 14 posts ] | Go to page Previous1, 2 |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group