Loading ...
Sorry, an error occurred while loading the content.

52289Re: [ydn-javascript] DataTable Cell Editor for HTML-formatted data

Expand Messages
  • Satyam
    Dec 28, 2009
      I think the Date Editor would be the perfect model for your RTE editor since it uses the Calendar Control, which has quite a complex markup, as its editing control.   You won't need to care much for any formatting since the plain formatter does nothing but insert whatever comes in the record field into the innerHTML of the cell, thus, no formatting is lost.  However, you might have to work a little bit with the default cell styles, thus, formatting would be more of a CSS issue than of code.  Alternatively, you might want to use a ToolTip to show the fully expanded text when the cursor is over a cell.  This will spare you from having cells too big or having scroll bars.  I have an example for that at: http://www.satyam.com.ar/yui/2.6.0/tooltips.html

      Also, remember that you are free to add extra options to the constructor, just like the dropdown, radio or checkbox cell editors do, so you can pass any configuration option from the constructor of the cell editor instance straight to the RTE, plus, you might want to add some of your own such as number of lines or width or whatever.  The RTE won't complain if it gets more configuration options than it needs, just make sure you don't use the same names so as not to confuse one set of options with the other.   Another feature you might want to add is to place the Save button in the toolbar of the RTE.  Drawing the cell editor buttons is a separate method which you may override to use your own way of doing it.

      You might have to work a little with the move method, which positions the cell editor over the cell.  You will probably don't want the RTE to have the same width as the column and, with columns close to the right border, you might want to align the top-right corner of the RTE to the cell.  If you don't give it enough width, the toolbar will flow into the next line and it won't look nice. 

      I think the textarea cell editor needs some reworking, it is not flexible enough in size and location.  There is no need for you to look into that one.  After all, the RTE uses a textarea as its basis so that a user without JavaScript enabled can still do some editing.  That is not your case, if the user has no JS, there won't be any DataTable or cell editor anyway so  you shouldn't concern yourself with sizing your base textarea to use it as such, you should go straight to formatting the RTE and don't care about having a decent textarea.

      There is a non-trivial issue with sizing and positioning.  By the time the cell editor move method is called, the editor is still invisible.  That means that some browsers will refuse to report position or size information about it.   You might have to force it to become visible so you can get proper measurements.  Do use the methods from the Dom utility, otherwise you will go crazy trying to compensate for different ways of measuring things.  Try it out without making it visible, you will probably be fine, but just make a note that this might be an issue if you see something funny happening there.


      El 28/12/2009 14:56, Brian McCullough escribió:
      I am working on converting an application that has a button that brings up an RTE to edit a text field that may ( probably will ) contain HTML-formatted text.  So far, so good.
      However, the next step is to convert this into a DataTable where there are a list of these Notes fields, using Cell Editors to edit them.  The issue is that the DataTable formatters and Cell Editors seem to deal only with plain text fields, displaying the HTML tags as well as the "printable" text.
      I suspect that I am going to have to manually manipulate both the displayed text and replace the Cell Editor to make this application best show the contents of the fields.  Dav Glass suggests that if I find a way to make the RTE work as a Cell Editor, he would like to see what I come up with.  Has anybody else encountered this sort of issue, or have any suggestions for accomplishing it?
      Incidentally, I also am having some problems with column widths here.  Setting "width:" in the Column Definitions doesn't seem to have any effect for the columns with the Textarea Cell Editor.  I can add the "resizable" property and change the width manually, but the default width is very small, creating scroll bars for even a short piece of text.
      I have looked at your DataGrid application, and see how this can help, but it only works with data types that are "known" to the existing Cell Editors, such as plain text fields.  I suspect that if I sort of reverse the "meta_" code, so that I extract the data from the column and somehow pass it to the RTE.  However, the RTE is looking for a "textarea" HTML tag to use, and I don't think that the DataTable is providing that, or is it?  Am I actually talking myself into the solution?
      Yahoo! Groups Links
      <*> To visit your group on the web, go to:
      <*> Your email settings:
          Individual Email | Traditional
      <*> To change settings online go to:
          (Yahoo! ID required)
      <*> To change settings via email:
      <*> To unsubscribe from this group, send an email to:
      <*> Your use of Yahoo! Groups is subject to:
      No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.722 / Virus Database: 270.14.121/2589 - Release Date: 12/27/09 10:18:00
    • Show all 9 messages in this topic