Clear/reset a dmx.app.data.serverconnect

@Patrick @Teodor

Any idea how can I clear/reset/null/destroy/oblitarate an AC server connect object from within the dmx namespace?

dmx-on:input.debounce:250="value ? serverconnect1.load({query: value}) : do what?"

Basically I need to clear the data or the object itself if the input value is empty.

I could use static js and the input event and dmx.parse the SC load and then null dmx.app.data.serverconnect1.data if input is empty but I don’t know if there is a better approach.

Have you tried this:

<input id="txt1" type="text" dmx-on:input.debounce:250="value ? serverconnect1.load({query: value}) : txt1.setValue('')">

From what I remember, the setting of empty value does not trigger input event again with empty value (recursively/infinitely).

Thanks for taking a shot at it.
Unfortunately my problem lays with the server connect data, not with the input. I need to clear the data contained in the server connect AC component when the input is empty.

So if I type “dog” it will search for dog, but if I backspace, delete or clear the input I need to clear the data in a SC AC component.

A simple JS like

dmx.app.data.scSearchResults.data = null;

works. So maybe wrap it in a dmxformatter?

I did have a need for this once. But then I found a better solution for my use case rather than having to do this.

I was hoping not to leave the dmx namespace or resort to nulling it. I would feel dirty and cheap doing that. But if there is no other option…

Maybe some undocumented AC method I wasn’t able to find.

@patrick any ideas on this one?

@patrick would it be useful to create an AC method to clear/destroy dmx child data/objects? Even if it’s not available in the UI. There might be advanced use cases where something like this is needed.

I’ve added a reset method to the server connect component.

dmxAppConnect.zip (22.5 KB)

Superb! Thanks!

Edit: confirmed it works.

This was implemented in Wappler 3.7.6