Defining Target ListBox

Everything related to the development of modules in jamovi
User avatar
mcfanda@gmail.com
Posts: 452
Joined: Thu Mar 23, 2017 9:24 pm

Defining Target ListBox

Post by mcfanda@gmail.com »

I have the following in module.u.yaml:

Code: Select all

  - type: CollapseBox
    label: Model
    collapsed: true
    stretchFactor: 1
    children:
        - type: Supplier
          name: randomSupplier
          persistentItems: false
          stretchFactor: 1
          children:
            - type: TargetLayoutBox
              label: Random Coefficients
              children:
                - type: ListBox
                  name: randomTerms
                  isTarget: true
                  template:
                    type: TermLabel

If I set the template of listbox LabelTerm I got the right UI but the terms (which are custom format) are shown overstroken. If I put the template type to "Label", the ui gets compiled very differently, the supplier looses its name and does not fit in the CollapseBox any more. Any hint?
dropmann
Posts: 79
Joined: Thu Feb 02, 2017 10:26 am

Re: Defining Target ListBox

Post by dropmann »

Hi mcfanda,

It's great to see you digging around in the UI. Let me start this conversation with saying that the ListBox control is a complicated beast which is still getting fine tuned. Because of the complexities of the ListBox definition the compiler can very quickly have difficulty applying generic layout patterns (although it can still be improved). But independent of that, let first start with, what is your custom format?
User avatar
mcfanda@gmail.com
Posts: 452
Joined: Thu Mar 23, 2017 9:24 pm

Re: Defining Target ListBox

Post by mcfanda@gmail.com »

First, thanks a lot for replying. I mean this:
https://github.com/mcfanda/jamovi_mixed ... docs/q.png

I need the target field to accept a terms that are custum format, basically strings. Is that possible?
User avatar
mcfanda@gmail.com
Posts: 452
Joined: Thu Mar 23, 2017 9:24 pm

Re: Defining Target ListBox

Post by mcfanda@gmail.com »

My custom format, which I defined in a "rtermFormat.js" file following other format js files, is a string like those:

(intercept | x)
(w|x)
(w*z|x)
(0+w|x)
dropmann
Posts: 79
Joined: Thu Feb 02, 2017 10:26 am

Re: Defining Target ListBox

Post by dropmann »

Is the rtermFormat.js in your github repo? If not that's fine just thought i'd have a look.
User avatar
mcfanda@gmail.com
Posts: 452
Joined: Thu Mar 23, 2017 9:24 pm

Re: Defining Target ListBox

Post by mcfanda@gmail.com »

to give you an idea, in this image the supplier is correct, but the target is not:

https://github.com/mcfanda/jamovi_mixed ... ocs/q2.png


the format is in https://github.com/mcfanda/jamovi_mixed ... mFormat.js
dropmann
Posts: 79
Joined: Thu Feb 02, 2017 10:26 am

Re: Defining Target ListBox

Post by dropmann »

Thanks, sorry i was looking in your glm repo. Let take a quick look...
User avatar
mcfanda@gmail.com
Posts: 452
Joined: Thu Mar 23, 2017 9:24 pm

Re: Defining Target ListBox

Post by mcfanda@gmail.com »

thanks, this helps alot because I'm stuck on this, the rest of the module is done :-)
dropmann
Posts: 79
Joined: Thu Feb 02, 2017 10:26 am

Re: Defining Target ListBox

Post by dropmann »

So lets try a few things. Well try this first.

A TermLabel has by default it's format set to `term`. This can be overridden. The danger of overriding the format of a specific control is making sure that our custom format has all the functions of the original format so that the control won't get into trouble. As you already know js doesn't have very strict typing. By the looks of it the format that you created in rtermFormat.js has the same functions as the term format so there should be any problems. So if you add `format: './rtermFormat'` as shown below, to the u.yaml file, it should work in regards to the format layout. Fingers crossed.

Code: Select all

- type: ListBox
    name: randomTerms
    valueFilter: unique
    isTarget: true
    template:
        type: TermLabel
        format: './rtermFormat'
dropmann
Posts: 79
Joined: Thu Feb 02, 2017 10:26 am

Re: Defining Target ListBox

Post by dropmann »

the compiler might have issue with this.
Post Reply