It is currently 23 January 2020, 10:44 Advanced search

How to implement Check Group Style

Questions and answers on how to best use Instant Developer

How to implement Check Group Style

Postby Girish » 16 September 2019, 14:42

i can implement radio style for any field and i can select any one item out of options and it displayed as follows
radiostyle.png
radiostyle.png (5.62 KiB) Viewed 636 times


While i want to have select multiple items together and want to show as follows
CheckGroupStyle.png
CheckGroupStyle.png (6.26 KiB) Viewed 636 times


So the Question is how to implement Check Group Style?.

Sample source code for Radio style is attached.
Attachments
CheckGroupTest.7z
Sample Source code for Radio Style
(269.36 KiB) Downloaded 49 times
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40

Re: How to implement Check Group Style

Postby ljwilson » 16 September 2019, 17:37

Radio buttons for the web work like my old am/fm radio did. You can only "push' one button at a time.
What you want is checkbox. The only way I've been able to do what you want is to have a separate checkbox for each value.

...jack
ljwilson
 
Posts: 502
Joined: 26 November 2013, 14:15

Re: How to implement Check Group Style

Postby lucabaldini » 17 September 2019, 14:14

@ljwilson is right... radio button are "single-value-fields", i.e. the field can be OptionA or OptionB or OptionC or OptionD... but only one of them.

What you are asking is that the property can be OptionA and OptionB and OptionC and OptionD, i.e. can have multiple values.

That can't be automatically done because you have only one Field where you store the value... but it can be done if you store "multiple values" in the same field...

I've changed your project a little. I've added a Load/Save methods for loading and saving the document into the IMDB table (that now is multi-row). This is needed for you example to work... normally documents are loaded/saved into database and that part is not needed..

And I've added 4 different "named property fields". Those are "logical properties", i.e. are not real property but the frameworks treat them as if they where true. Try the example and look at the debug window to see how the example works.

What I've done is that your "Option" property contains now four differen values: [OPT1][OPT2][OPT3][OPT4]... so that if its value is 1001 than Option1 and Option4 are selected. Then I've implemented events that allow the system to read and write "logical" OPTIONS[XX] properties from/into the true Option property.
Attachments
CheckGroupTest-Updated.7z
(281.48 KiB) Downloaded 50 times
User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 3848
Joined: 1 October 2010, 17:03
Location: Bologna

Re: How to implement Check Group Style

Postby ljwilson » 19 September 2019, 12:32

Luca,

That is a great example--I will have to try that next time I need some multi-options.

Thanks for sharing!

...jack
ljwilson
 
Posts: 502
Joined: 26 November 2013, 14:15

Re: How to implement Check Group Style

Postby lucabaldini » 19 September 2019, 13:30

:-))
User avatar
lucabaldini
Pro Gamma
Pro Gamma
 
Posts: 3848
Joined: 1 October 2010, 17:03
Location: Bologna

Re: How to implement Check Group Style

Postby Girish » 19 September 2019, 14:08

Thanks @ljwilson for pointing me to right direction. just after your reply I implemented it quickly to suffice the requirement.(later lucabaldini replied)
Thanks @lucabaldini for nice sample, i will change implementation with as you suggested.
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

cron