[ANN]: 4D Component to build a property list

With the new possibility having object fields in 4D we wanted to have an easy way to show the data with in this field. Although 4D has a way to do so, we thought whether we could do this within a webarea as well. And in fact, it works for our needs well.

As a result, we’ve created a component where we’d like to shared on GitHub.

It’s not well documented, but as you consider the example code you may find the way how to use or adapt for your own needs.

My I should point out, this component supports following HTML input types: text, textarea, password, checkbox and select-one. The later does support options with values and without.

There you can get the source code: https://github.com/4dgeek/4d-component-propertyList
Kind Regards
Rolf

[]19466711;“Your comment here…”[/]

Very nice, thanks !

I’ve updated the repository:

  • bugfixes in the select item
  • new setters to build the property list
  • new option for the textarea to setup the number of rows

<code 4D>
If (True) //Declaration
C_OBJECT($option_o)
End if

If (Form event=On Load) //wa on load

If (False) //First steps
propertyList_SetDemoContent
propertyList_SetContent (“propertyList”;JSON Stringify array(propertyList_settings_ao);“myCallback”)

Else
ARRAY OBJECT($propertyList_settings_ao;0) //create an object array

//append the various input type as you like an group them
propertyList_AppendText (->$propertyList_settings_ao;“Group one”;“email1”;“Email 1";"user@hotmail.com”)
propertyList_AppendTextarea (->$propertyList_settings_ao;“Group one”;“tea1”;“Textarea 1”;“Example Textarea 1”;2;True)
propertyList_AppendPassword (->$propertyList_settings_ao;“Group one”;“pw1”;“PW 1”;“MyPassword”)
propertyList_AppendButton (->$propertyList_settings_ao;“Group one”;“btn1”;“Click me”;“Info”)
propertyList_AppendCheckbox (->$propertyList_settings_ao;“Group two”;“cb1”;“Checkbox 1”;False;False)
propertyList_AppendNumber (->$propertyList_settings_ao;“Group two”;“real1”;“My real value”;7.8)

//Select examples
ARRAY OBJECT($OptionValue_ao;0)
OB SET($option_o;“option”;“4th Dimension”;“value”;“4d”)
APPEND TO ARRAY($OptionValue_ao;OB Copy($option_o))
OB SET($option_o;“option”;“Java Script”;“value”;“js”)
APPEND TO ARRAY($OptionValue_ao;OB Copy($option_o))
propertyList_AppendSelect (->$propertyList_settings_ao;“Group two”;“select1”;“Select by code”;“4d”;True;->$OptionValue_ao)
propertyList_SetContent (“propertyList”;JSON Stringify array($propertyList_settings_ao);“myCallback”)

End if

End if

</code 4D>

< https://github.com/4dgeek/4d-component-propertyList>

have fun

It is a complete example : I could then discover easily how that works and I implemented it.
I improved it for my needs to display more information, as a nested table :
Thanks :smiley:

[]19497426;“Your comment here…”[/]

i used my component Object4D* with dot notation to reduce number of lines to code

Hi Berhard,

I know your component as well. Good job btw.
For the nested table, are you willing to share a snippet? May I could implement that on the github version as well :slight_smile:

Rolf

Ok to share ; give me your mail (mine bernard@escaich.com), I will send you my version and you will be free to publish.

I will also update my component…