Weird 'data container' behaviour

Hi, I have an curious behaviour :

Amongst the components in my page, I have an alert dialog which I made from an overlay block, containing a panel (which acts as the dialog box).
The purpose of the overlay is to receive clicks outside the alert, to discard it.
In the alert panel, I have a text box which I populate with data item coming from a repeatable)

The problem is the following :
When I set the data model to the alert panel, it does not work, and I get no text (properties are ‘undefined’)
When I set the data model to the underlying overlay block, it does work fine.
Capture d’écran 2024-08-06 à 17.03.31

Why would that be, and would it not be cleaner if the data model of the panel itself worked ?

Hello @MF_de_Preval

Is your applicationId 5828264F-A34B-5C49-FFD5-3FA0319B2D00?
Are you talking about the Locataires page in the Work container?

I don’t see the logic in what you described here.

Regards,
Volodymyr

Thanks for looking …
App Id, page and container OK.

The logic is on the delete icon button of the repeatable :

Hi @MF_de_Preval ,

Sorry for the long delay. Do you still need a help with this problem?

Regards, Andriy

Hello Andriy,

Yes, as much as I can find a workaround for a simple modal alert dialog, It becomes a nightmare with a modal form where I have to pre-populate select components, and deal with many fields, because data binding won’t work (form data model does not get set, just like this more simple example).

other way of putting the question : how can I have a working modal alert (or form) ?

Hello @MF_de_Preval

I see that now you have logic like:


And as for me it looks correct and works.
What problems did you encounter using this method?

You can also wrap these three blocks into one function.

Regards

Hi Viktor,
Thanks for looking.

As it happens, this eventually works (though i’ prefer having my alert within the overlay, and have a single visibility toggle for the whole modal, but as exposed, this does not work).

So I can replicate this for a more elaborate Form. Except that there is a show stopper issue with the select components in the form.
I already had a ticket openened for this (select with data binding does not behave correctly in this case. It does not want to change value) :

Now, since I need to get forward, I tried to find a workaround, and set the select value manually (no data binding) :

But this does not work either (select component still undefined though made visible … ) !
Capture2

now I’m stuck … is there a workaround of the workaround ?

@MF_de_Preval

Most likely, the error means that when the block “Get component by id - Form_select_location” is called, the Form_select_location selecnt is not on rendered. Is it rendered? Where is that select located so I can check?

Regards

Hi Viktor.

Thanks for coming back.

As a summary, I have tried 2 methods for gettings things done, and I’m working on a third (the workaround of the workaround), which gets me other troubles as well …

  1. set data model to the form, and bind the form field, including select
    Does not work because select does not want to change when changed (this is a backendless bug, ticket openend by Serguey ) …
    You can find the behaviour on the ‘sandbox’ page of my app.

  2. set data model to the form, and bind the form field, but not select - select is set manually
    Does not work because select is ‘undefined’, despite beeing actually rendered
    You can find the behaviour on the ‘locataires’ page of my app.

Now I’m working on a third (!) method, which gives correct results regarding the ‘select’
3) set a page variable with the data, and bind the form to this page data excluding select .
select has to be bound to an other page variable to work !


But this method does not work properly because when I want a fresh form, it does not want to reset:
Capture3

Also, I mention that i had tried a fourth method initially, which did not work AT ALL, by embedding the form into a block. Nothing in the form was accessible when toggling visibility. Now I have to deal with separate shadow / overlay for making my form being modal …

Suggestion : somenone at Backendless makes a working modal component, because honestly, I have spent many hours on this which could have been used more productively …
(Nevertheless, I thank you for the time you take on this thread).

Hello @MF_de_Preval

Sorry for the all inconvenience.

Is it possible to handle that in a straight way? What I mean is - do not use data model or reset form blocks. Just write some object in page data when the modal is opened and you already know what you will be editing. Store it like - editingObject and bind everything to this object in page data, all other actions like reset form also handled in a simple way. In the reset form example just rewrite this object with the new empty object and so on.

Hi Dima,

Thanks for your insight.
If I understand you correctly, this is indeed the 3rd method I’m using.
It does work, with 2 caveats :

  • the select component into the form cannot be bound to this editingObject (in my case it’s item_selected) because of upstream bug (there is a ticket for this)
  • I wanted to make an empty object independant of its model (so that I don’t have to rewrite things if database model changes), but I did not succeed so far … (see post Weird logic Variable behaviour)

If you have a way to make an object with all its properties set to null, without explicitely assigning all of them, I’m a happy camper …

I’ll work on that anyway …

Hello, @MF_de_Preval

There’s no need to explicitly set all object values to null, just rewrite this page data object with the new empty object.

Regards,
Serhiy