This page results from a click on the Controlled Thermostat table “Heat” value (65 deg). After rendering the numeric input for the new “Set Heating Setpoint for Downstairs Thermostat”, the app returns to the main page, with the updated “Heat” value in the Controlled Thermostat table.
I’ve read the Developer docs, not seeing how to accomplish this in there. I have a functional AppButtonHandler connected to my table data field of interest, just don’t know how to code the modal entry to allow modification of the data field.
And some creativity. (These aren't "official" components in the UI, just some HTML and CSS tricks. They are unlikely to break given their use by some internal apps, but this is not guaranteed, and they are not documented for that reason.)
Here is one topic that gives one example--I know it focuses on the table, though the "button" input thing it uses is really all you asked about:
For an entire working example, see also the "Lights Usage Table" example app linked to in a post there.
Essentially just wanting a table editor for a Map, so this is good enough for now. Definitely more grunt work than expected, partly due to my capabilities, but also a function of the UI framework's limitations.
The original design was for each record to have three clickable buttons (Edit, Copy, Delete). Edit would invoke an 'Edit Record' page, Copy and Delete don't require any intervening pages. I had trouble getting the href links to work as outlined by @bravenel in the thread you referenced. So I reluctantly ditched the 'Edit' button and resorted to a "select record" then "edit selected record" approach.
The View Setpoint Table Json.. is for debugging purposes.
Any code example or help in getting the href links working would be welcome.
Thanks, what I was having trouble with was the "href to a page" where the page is defined within preferences(), not to a url target. In my case using a button event on a table field (text or icon) to invoke my "recordEditorPage" defined in the same app, the same way as the "href" block method does with:
After clicking on the "Edit" link, app throws the following error in the log:
app:4376 2023-11-10 11:36:26.543 AM Error org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: java.lang.String.call() is applicable for argument types: (java.util.HashMap) values: [[2300:76, 2200:auto]] Possible solutions: wait(), chars(), any(), wait(long), any(groovy.lang.Closure), take(int) (jsonViewerPage)
I don't use hrefLink any more, only buttonLink. Rather than use params for table embedded href (see for example Actions in Rule Machine, where clicking on the action opens a page to edit the action), I use a state object.
Thanks, I will attempt the same. Couldn't get the hrefLink params to work. I'm setting and clearing a state object for the "delete" and "copy" actions with success; these don't require a page to map - just code to modify the table map I'm maintaining. Will need to code rendering of the "edit" page to intervene after the button press.
In RM there is just a normal href that is called from state being set from appButtonHandler, coming from buttonLink -- but it doesn't pass params, sets a state for which action is being edited. params have problems anyway, especially with embedded pages returning (no params). So called pages usually have to put params in state anyway.