Have you looked at TableKit for this? It's remarkably easy to add to a table, static or dynamic, all you do is ad the classname editable to your table head above the column you want to edit.

Walter

On Oct 27, 2010, at 6:34 PM, BrentNicholas wrote:

Hi all,

I've been wrestling with this for a little bit now and figure it's
time to ask for help. I can't seem to find anything on the web.

I have a dynamicly generated table, I want to have an InPlaceEditor
instance on each table cell. From what I can tell you need to do a
'new' object on it for every cell so that the hover over highlight
shows, letting you know that the InPlaceEditor is connected to the
table cell.

Table Struct:
(The <p> tag was what I saw in examples and am using it since that's
what works now)
<table id="idProgramsTBL">
<tr class="mainRow">
        <td id="tdPrgCd"><p id="idPrgCdP#ProgramUID#"
class="clsPrgCdP">#ProgramCode#</p></td>


I've tried the following, to no avail:

// this works but has the problem described below
$('idProgramsTBL').select('[class="clsPrgCdP"]').invoke("observe",
"click", function(event){ codeEditInPlace(this.id); });

// this works but is incorrect as it will create a new instance of the
InPlaceEditor on each 'click'
// thus you can get 1 to n editors in the cell for every click
// Also, this connects the editor after the click, so you end up
clicking twice
function codeEditInPlace(id)
{
        new Ajax.InPlaceEditor(id ,'act_setProgramCode.cfm?ProgramUID='+id,
                {
                        onFailure: placeError,
                        onComplete: refreshProgramCode,
                        rows: 2,
                        cols: 20
                }
        );
}

The problem is that the above is based on creating and attaching the
InPlaceEditor when the user clicks, vs after the Ajax.Request
completes. I am calling the ".invoke.observe" statement above in a
function fired by the "onComplete" call back of Ajax.Request

So how do I find all the items of this class (class name of table cell
or P tag) and create a new InPlaceEditor on it.

I've got the following to get the classes of the P tags in the table
cells:
$('idResultsTableTBL').select('[class="clsPrgCdP"]')

I found this but I don't think it's of help:
var codeCellArray =  $A(['clsPrgCd']);

codeCellArray.each(function(aCell) {
        alert(aCell);
});


Thoughts?

Thanks for your time,
Brent

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en .


--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to