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

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

Expand Messages
  • Brian McCullough
    ... Satyam ( and anybody else ), As I predicted, I have come up with a question. Following your suggestion, I copied the DateCellEditor code out of
    Message 1 of 9 , Dec 29, 2009
    • 0 Attachment
      On Mon, Dec 28, 2009 at 07:50:16PM -0800, Brian McCullough wrote:
      > On Mon, Dec 28, 2009 at 03:51:08PM +0100, Satyam wrote:
      >
      > The next step is to use your suggestion of using the Date Editor to assist me with the RTE part.

      Satyam ( and anybody else ),

      As I predicted, I have come up with a question.

      Following your suggestion, I copied the DateCellEditor code out of CellEditor.js ( in the API Documentation ), into a file in my own directory-space, and made what seemed to me to be appropriate changes. ( I tried to do nothing major to start with, just get a basic RTE rendered. ) I copied the "shortcut" var definitions from the beginning of the file, and the whole definition of DateCellEditor.


      So I started with:

      widget.DateCellEditor = function(oConfigs) {
      this._sId = "yui-dateceditor" + YAHOO.widget.BaseCellEditor._nCount++;
      widget.DateCellEditor.superclass.constructor.call(this, "date", oConfigs);
      };

      and changed it to:

      widget.RTECellEditor = function(oConfigs) {
      this._sId = "yui-rteceditor" + YAHOO.widget.BaseCellEditor._nCount++;
      widget.RTECellEditor.superclass.constructor.call(this, "rte", oConfigs);
      };


      I also compared the DateCellEditor to the TextareaCellEditor where I was unsure.


      At this point, I am getting an error complaining that "widget.RTECellEditor.superclass" is not defined. Is there something else that I need to copy from the CellEditor.js file that will help to define this, or is it not actually necessary?

      Since both DateCellEditor and TextareaCellEditor use the same construct, I don't think that I have acually mis-spelled anything, and my understanding is that the BaseCellEditor should be the superclass, but I would suspect that the RTECellEditor might need to be known to the BaseCellEditor, or in some other way properly included with that class.

      I do have the line:

      lang.extend(widget.RTECellEditor, BCE, {

      Just after the above, as it is for the other Cell Editors, but that obviously doesn't really do the trick.


      Thanks,
      Brian
    • Satyam
      Are you including this file after including the DataTable source file? Does BCE exist at all? Have you made it an alias of BaseCellEditor? I say this because
      Message 2 of 9 , Dec 29, 2009
      • 0 Attachment
        Are you including this file after including the DataTable source file?  Does BCE exist at all? Have you made it an alias of BaseCellEditor?  I say this because you are using the alias BCE in the extend but not in the constructor.  If you are running it with the debugger to break on all errors, lang.extend should have failed. 

        Also, run JSLint and make sure you don't have any more globals than you should nor that you have any unused variables, that usually indicates some misspelling and possibly a fatal typo.

        Satyam

        El 29/12/2009 20:38, Brian McCullough escribió:
        On Mon, Dec 28, 2009 at 07:50:16PM -0800, Brian McCullough wrote:
          
        On Mon, Dec 28, 2009 at 03:51:08PM +0100, Satyam wrote:
        
        The next step is to use your suggestion of using the Date Editor to assist me with the RTE part.
            
        Satyam ( and anybody else ),
        
        As I predicted, I have come up with a question.
        
        Following your suggestion, I copied the DateCellEditor code out of CellEditor.js ( in the API Documentation ), into a file in my own directory-space, and made what seemed to me to be appropriate changes. ( I tried to do nothing major to start with, just get a basic RTE rendered. )  I copied the "shortcut" var definitions from the beginning of the file, and the whole definition of DateCellEditor.
        
        
        So I started with:
        
        widget.DateCellEditor = function(oConfigs) {
            this._sId = "yui-dateceditor" + YAHOO.widget.BaseCellEditor._nCount++;
            widget.DateCellEditor.superclass.constructor.call(this, "date", oConfigs); 
        };
        
        and changed it to:
        
        widget.RTECellEditor = function(oConfigs) {
        this._sId = "yui-rteceditor" + YAHOO.widget.BaseCellEditor._nCount++;
        widget.RTECellEditor.superclass.constructor.call(this, "rte", oConfigs); 
        };
        
        
        I also compared the DateCellEditor to the TextareaCellEditor where I was unsure.
        
        
        At this point, I am getting an error complaining that "widget.RTECellEditor.superclass" is not defined.  Is there something else that I need to copy from the CellEditor.js file that will help to define this, or is it not actually necessary?
        
        Since both DateCellEditor and TextareaCellEditor use the same construct, I don't think that I have acually mis-spelled anything, and my understanding is that the BaseCellEditor should be the superclass, but I would suspect that the RTECellEditor might need to be known to the BaseCellEditor, or in some other way properly included with that class.
        
        I do have the line:
        
        lang.extend(widget.RTECellEditor, BCE, {
        
        Just after the above, as it is for the other Cell Editors, but that obviously doesn't really do the trick.
        
        
        Thanks,
        Brian
        
        
        
        
        ------------------------------------
        
        Yahoo! Groups Links
        
        <*> To visit your group on the web, go to:
            http://groups.yahoo.com/group/ydn-javascript/
        
        <*> Your email settings:
            Individual Email | Traditional
        
        <*> To change settings online go to:
            http://groups.yahoo.com/group/ydn-javascript/join
            (Yahoo! ID required)
        
        <*> To change settings via email:
            ydn-javascript-digest@yahoogroups.com 
            ydn-javascript-fullfeatured@yahoogroups.com
        
        <*> To unsubscribe from this group, send an email to:
            ydn-javascript-unsubscribe@yahoogroups.com
        
        <*> Your use of Yahoo! Groups is subject to:
            http://docs.yahoo.com/info/terms/
          
        No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.722 / Virus Database: 270.14.123/2592 - Release Date: 12/29/09 08:47:00
      • Brian McCullough
        ... Yes. ... I used the set of shortcut variable definitions that were in CellEditor.js: var lang = YAHOO.lang, util = YAHOO.util, widget = YAHOO.widget,
        Message 3 of 9 , Dec 29, 2009
        • 0 Attachment
          On Tue, Dec 29, 2009 at 09:44:26PM +0100, Satyam wrote:
          > Are you including this file after including the DataTable source file?

          Yes.


          > Does BCE exist at all? Have you made it an alias of BaseCellEditor? I
          > say this because you are using the alias BCE in the extend but not in
          > the constructor.

          I used the set of shortcut variable definitions that were in CellEditor.js:

          var lang = YAHOO.lang,
          util = YAHOO.util,
          widget = YAHOO.widget,
          ua = YAHOO.env.ua,

          Dom = util.Dom,
          Ev = util.Event;

          var BCE = widget.BaseCellEditor;


          > If you are running it with the debugger to break on
          > all errors, lang.extend should have failed.

          Actually, it doesn't seem to be failing any more ( at least, not that way ). I have the DataTable displaying, the ToolTips are displaying, and the Cell Editor box is popping up, but it is definitely not the Rich Text Editor. I know that the constructor is getting called, because I can put a breakpoint in there and have it fire. Getting closer.


          > Also, run JSLint and make sure you don't have any more globals than you
          > should nor that you have any unused variables, that usually indicates
          > some misspelling and possibly a fatal typo.

          I had already run JSLint on the "rtecelleditor.js" file alone, with no errors.




          > Satyam

          Brian
        • Brian McCullough
          Satyam, So near and yet so far. I am now able to do everything that I need to do, up to the point where the Editor window opens. It is a valid RTE window, but
          Message 4 of 9 , Dec 30, 2009
          • 0 Attachment
            Satyam,

            So near and yet so far.

            I am now able to do everything that I need to do, up to the point where the Editor window opens. It is a valid RTE window, but just does not have any content.

            This is understandable, since I don't think that the cell has any content at the point where the Editor is rendered. However, at the point where it is opened and shown to the user, I need to inform the Editor about the content. This is handled in "normal" RTE code by having "editor.setEditorHTML( content of textarea )" in cases where you want to dynamically change the content of the Editor.

            I thought of using showEvent, but found that there are many different showEvents.

            I now have "this.subscribe( "showEvent", function( oArgs ){ rte.setEditorHTML( this.textarea.value ); }); " inside the render() method of the RTECellEditor, but that doesn't seem to work. I am sure that I am missing something obvious, so I would appreciate a kick in the right direction.


            Thank you,
            Brian
          • Satyam
            You should place the code to fill the editor with the value to edit in method resetForm. You might also need to override method focus to set the focus in the
            Message 5 of 9 , Dec 30, 2009
            • 0 Attachment
              You should place the code to fill the editor with the value to edit in method resetForm.  You might also need to override method focus to set the focus in the editing window of the RTE if it doesn't show there already.

              RTE is not really my strong point so don't address questions on that to me because I will probably be unable to help you.

              Satyam

              El 30/12/2009 20:39, Brian McCullough escribió:
              Satyam,
              
              So near and yet so far.
              
              I am now able to do everything that I need to do, up to the point where the Editor window opens.  It is a valid RTE window, but just does not have any content.
              
              This is understandable, since I don't think that the cell has any content at the point where the Editor is rendered.  However, at the point where it is opened and shown to the user, I need to inform the Editor about the content.  This is handled in "normal" RTE code by having "editor.setEditorHTML( content of textarea )" in cases where you want to dynamically change the content of the Editor.
              
              I thought of using showEvent, but found that there are many different showEvents.
              
              I now have "this.subscribe( "showEvent", function( oArgs ){ rte.setEditorHTML( this.textarea.value ); }); " inside the render() method of the RTECellEditor, but that doesn't seem to work.  I am sure that I am missing something obvious, so I would appreciate a kick in the right direction.
              
              
              Thank you,
              Brian
              
              
              
              ------------------------------------
              
              Yahoo! Groups Links
              
              <*> To visit your group on the web, go to:
                  http://groups.yahoo.com/group/ydn-javascript/
              
              <*> Your email settings:
                  Individual Email | Traditional
              
              <*> To change settings online go to:
                  http://groups.yahoo.com/group/ydn-javascript/join
                  (Yahoo! ID required)
              
              <*> To change settings via email:
                  ydn-javascript-digest@yahoogroups.com 
                  ydn-javascript-fullfeatured@yahoogroups.com
              
              <*> To unsubscribe from this group, send an email to:
                  ydn-javascript-unsubscribe@yahoogroups.com
              
              <*> Your use of Yahoo! Groups is subject to:
                  http://docs.yahoo.com/info/terms/
                
              No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.722 / Virus Database: 270.14.123/2594 - Release Date: 12/30/09 08:27:00
            • Brian McCullough
              ... Thank you. That was exactly the cue that I needed. It Lives! ... Thanks, I will keep that in mind. At the moment, I don t think it is necessary. ... I
              Message 6 of 9 , Dec 30, 2009
              • 0 Attachment
                On Wed, Dec 30, 2009 at 09:24:43PM +0100, Satyam wrote:
                > You should place the code to fill the editor with the value to edit in
                > method resetForm.

                Thank you. That was exactly the cue that I needed. It Lives!


                > You might also need to override method focus to set
                > the focus in the editing window of the RTE if it doesn't show there
                > already.

                Thanks, I will keep that in mind. At the moment, I don't think it is necessary.



                > RTE is not really my strong point so don't address questions on that to
                > me because I will probably be unable to help you.

                I understand that. That's why I was focusing on how to use the Cell Editor.



                > Satyam


                Brian
              Your message has been successfully submitted and would be delivered to recipients shortly.