Static list value vs. display

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Static list value vs. display

Jason Clemons
Hello all,

I'm not sure if I'm doing something wrong or not, but I have an issue with my static lists.  I set the "value" as follows:

1-choice 1|2-choice 2|3-choice 3

when I view my form I see the choices as follows:

choice 1
choice 2
choice 3

which is what I expect, however...if I change the value before the dash or remove the
selection all together from the class all items which have that selection get the "hidden" value.

For instance, if a page was created using "choice 1", and the selection of "choice 1" exists in the class, then viewing the page will indeed show "choice 1".  However, if I remove  "choice 1" or change it to "selection 1" for instance, then all instances previously using that selection will then display "1".

is there any way to prevent previously created pages from changes when the class changes?
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Static list value vs. display

Eduard Moraru
Hi,

Objects only store the selected value when the value is set, not the
value's label. The class is in charge of storing the list of possible
values and their labels.

The field displayer displays the currently stored value inside the object
using the current list of available value labels from the class. If the
currently stored value in an object is no longer in the list of values of
the class, the raw value is displayed instead of a value label.

Changes on the class impact the display of all the objects of that class.
Yo can safely change a value's label in the class and all objects will
display that value with the new label, but if you remove the value from a
class, objects will no longer *know* how to display your (now) unknown
value.

Hope that clarifies things.

Thanks,
Eduard

On Tue, Oct 7, 2014 at 6:37 PM, Jason Clemons <[hidden email]>
wrote:

> Hello all,
>
> I'm not sure if I'm doing something wrong or not, but I have an issue with
> my static lists.  I set the "value" as follows:
>
> 1-choice 1|2-choice 2|3-choice 3
>
> when I view my form I see the choices as follows:
>
> choice 1
> choice 2
> choice 3
>
> which is what I expect, however...if I change the value before the dash or
> remove the
> selection all together from the class all items which have that selection
> get the "hidden" value.
>
> For instance, if a page was created using "choice 1", and the selection of
> "choice 1" exists in the class, then viewing the page will indeed show
> "choice 1".  However, if I remove  "choice 1" or change it to "selection 1"
> for instance, then all instances previously using that selection will then
> display "1".
>
> is there any way to prevent previously created pages from changes when the
> class changes?
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Static list value vs. display

Jason Clemons
hmmm...I assumed that anything spawned as an instance of the base class would have their own copy of the properties that persisted.

Your explanation certainly helps, but it seems that this approach means that changes to the base class will influence all of its iterations, making business logic changes very difficult to implement.  

Thanks for taking the time to respond.



> On Oct 8, 2014, at 3:14 PM, Eduard Moraru <[hidden email]> wrote:
>
> Hi,
>
> Objects only store the selected value when the value is set, not the
> value's label. The class is in charge of storing the list of possible
> values and their labels.
>
> The field displayer displays the currently stored value inside the object
> using the current list of available value labels from the class. If the
> currently stored value in an object is no longer in the list of values of
> the class, the raw value is displayed instead of a value label.
>
> Changes on the class impact the display of all the objects of that class.
> Yo can safely change a value's label in the class and all objects will
> display that value with the new label, but if you remove the value from a
> class, objects will no longer *know* how to display your (now) unknown
> value.
>
> Hope that clarifies things.
>
> Thanks,
> Eduard
>
> On Tue, Oct 7, 2014 at 6:37 PM, Jason Clemons <[hidden email]>
> wrote:
>
>> Hello all,
>>
>> I'm not sure if I'm doing something wrong or not, but I have an issue with
>> my static lists.  I set the "value" as follows:
>>
>> 1-choice 1|2-choice 2|3-choice 3
>>
>> when I view my form I see the choices as follows:
>>
>> choice 1
>> choice 2
>> choice 3
>>
>> which is what I expect, however...if I change the value before the dash or
>> remove the
>> selection all together from the class all items which have that selection
>> get the "hidden" value.
>>
>> For instance, if a page was created using "choice 1", and the selection of
>> "choice 1" exists in the class, then viewing the page will indeed show
>> "choice 1".  However, if I remove  "choice 1" or change it to "selection 1"
>> for instance, then all instances previously using that selection will then
>> display "1".
>>
>> is there any way to prevent previously created pages from changes when the
>> class changes?
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Static list value vs. display

jerem
Hi,

There are a number of ways to workaround this behaviour, but it all depends
on what you want to achieve specifically ?
For example you could leave all the choices (raw values/labels) in the
xwiki class, but remove some from display in edit mode using a custom
displayer.
Or manage to show the missing labels (not anymore in the class) with a
custom displayer.

BR,
Jeremie

2014-10-09 3:38 GMT+02:00 Jason Clemons <[hidden email]>:

> hmmm...I assumed that anything spawned as an instance of the base class
> would have their own copy of the properties that persisted.
>
> Your explanation certainly helps, but it seems that this approach means
> that changes to the base class will influence all of its iterations, making
> business logic changes very difficult to implement.
>
> Thanks for taking the time to respond.
>
>
>
> > On Oct 8, 2014, at 3:14 PM, Eduard Moraru <[hidden email]> wrote:
> >
> > Hi,
> >
> > Objects only store the selected value when the value is set, not the
> > value's label. The class is in charge of storing the list of possible
> > values and their labels.
> >
> > The field displayer displays the currently stored value inside the object
> > using the current list of available value labels from the class. If the
> > currently stored value in an object is no longer in the list of values of
> > the class, the raw value is displayed instead of a value label.
> >
> > Changes on the class impact the display of all the objects of that class.
> > Yo can safely change a value's label in the class and all objects will
> > display that value with the new label, but if you remove the value from a
> > class, objects will no longer *know* how to display your (now) unknown
> > value.
> >
> > Hope that clarifies things.
> >
> > Thanks,
> > Eduard
> >
> > On Tue, Oct 7, 2014 at 6:37 PM, Jason Clemons <[hidden email]>
> > wrote:
> >
> >> Hello all,
> >>
> >> I'm not sure if I'm doing something wrong or not, but I have an issue
> with
> >> my static lists.  I set the "value" as follows:
> >>
> >> 1-choice 1|2-choice 2|3-choice 3
> >>
> >> when I view my form I see the choices as follows:
> >>
> >> choice 1
> >> choice 2
> >> choice 3
> >>
> >> which is what I expect, however...if I change the value before the dash
> or
> >> remove the
> >> selection all together from the class all items which have that
> selection
> >> get the "hidden" value.
> >>
> >> For instance, if a page was created using "choice 1", and the selection
> of
> >> "choice 1" exists in the class, then viewing the page will indeed show
> >> "choice 1".  However, if I remove  "choice 1" or change it to
> "selection 1"
> >> for instance, then all instances previously using that selection will
> then
> >> display "1".
> >>
> >> is there any way to prevent previously created pages from changes when
> the
> >> class changes?
> >> _______________________________________________
> >> users mailing list
> >> [hidden email]
> >> http://lists.xwiki.org/mailman/listinfo/users
> > _______________________________________________
> > users mailing list
> > [hidden email]
> > http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users