Clear Text from Table Cell When Entering Edit Mode

Hi All,

I’m running Perspective on 8.0.16 and working with the Table component. I’m trying to program some (seemingly) simple functionality, but I can’t figure it out.

I want a user to single-click on a cell (that has the text ‘Enter Text’) and enter into Edit mode for that cell. But I want the default ‘Enter Text’ to be deleted when the user enters Edit mode so they don’t have to delete it themselves.

I don’t appear to have script-level control of the text in the cell once it enters into Edit mode, so I can’t remove it after entering Edit mode. I also have no luck with creating an onOnClick event to clear the text - some of the time the text is cleared out, but the cell doesn’t enter Edit mode. Then at other times, the cell enters Edit mode, and the text isn’t cleared out.

If I could inset a script after the onEditCellStart event began but before it executed its code, that would help. Or if I could order what event came first on a button click, that would also solve this. But I don’t believe either of those are possible.

Seems like a simple problem to solve - any suggestions?

Thanks in advance.

The ideal way to do this would be to use the placeholder attribute for the text field; then the browser would take care of clearing it when you start typing. Unfortunately, the table doesn’t (currently) expose any ability to set a placeholder. What you could do instead is use a view rendering mode, and have a simple view containing a text field (with the placeholder attribute properly set).