Editable Web Listbox Cell Project Needs Input

Hello Everyone. Im using WebListboxCellRenderer to create a custom listbox cell that is editable. Currently I have it styled how I like in the app header. In the contstant kJavascriptClass Ive got everything set correct to it puts an editable input text field in the cell. Everything renders just fine. The problem is with the string being passed in. It will only display the first word of a string passed in. It should be displaying the whole string. If anyone can open the project and see what Im doing wrong, it would be greatly appreciated. Here’s the link to the downloadable project.

Editable Cell Renderer Project

Your link is not public.

Sorry about that. I changed it to public so you can try again.

Try this:

cell.innerHTML = '<input class="editableCell" type="text" value="' + data.cellValue + '" ;> ';

Brilliant! It works! Who knew an editable cell was so simple! Thanks for the help!

Hey Alberto, Would you mind looking at the project again for the ListboxCheckboxCell renderer that I added? When I pass in false, there should an empty checkbox. No matter what I do to the kJavascriptClass string, it will not show as unchecked. If your not to busy. Thank you.

The checked attribute is true when it exists, not when it has a boolean value of true. So if you have the attribute on the node at all, the value is true for the checkbox.

Use this:

cell.innerHTML = '<input class="listboxCheckbox" type="checkbox"' + (data.cellCheck ? ' checked' : '') + '> ';

Something not quite right with the string. As soon as I insert it, it fails to run. I replaced from where the cell.innerHTML. I appreciate your help Anthony. You’re always awesome about this stuff.

Here’s the full constant value:

class ListboxCheckboxCell extends XojoWeb.ListboxCellRenderer {
    render(controlID, row, data, rowIndex, columnIndex, cell) {
        cell.innerHTML = '<input class="listboxCheckbox" type="checkbox"' + (data.cellCheck ? ' checked' : '') + '> ';
    }
}

Is it running for you? I replaced the whole value for the constant and it still does the same thing. Acts like its going to run and then just stops all together.

Yes.

Weird. Some little hiccup with Xojo. I had several projects opened so I shut them all down and restarted the project and now it works. Thanks so much for you help!

Anytime.

I downloaded your test project, attempted to run and fails when I add Anthony’s code. Did you fix something else besides the constant?
Thanks

It should be running fine now. I did add a few more things. Some events for listbox customCellAction.

1 Like

Yeah, thanks. It was me being dumb. Your example project works as expected. Thanks for sharing :slight_smile: