Page 1 of 3

Defining Target ListBox

Posted: Tue Oct 03, 2017 3:09 pm
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?

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 10:34 pm
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?

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 10:53 pm
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?

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 10:57 pm
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)

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:02 pm
by dropmann
Is the rtermFormat.js in your github repo? If not that's fine just thought i'd have a look.

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:06 pm
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

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:07 pm
by dropmann
Thanks, sorry i was looking in your glm repo. Let take a quick look...

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:12 pm
by mcfanda@gmail.com
thanks, this helps alot because I'm stuck on this, the rest of the module is done :-)

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:26 pm
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'

Re: Defining Target ListBox

Posted: Tue Oct 03, 2017 11:28 pm
by dropmann
the compiler might have issue with this.