xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

Bug in multiple select list with more than approximately 50 options #114

Open velo6raptor opened 11 years ago

velo6raptor commented 11 years ago

We have defined a Grails Bean Composant self linked with a hasMany relation to composants In the edit form of the Composant, ZKUI generates the multiple select list <zkui:select name="composants" from="${vdo.catapp.Composant.findAll("from Composant where actif=true order by libelle")}" multiple="true" checkmark="true" optionKey="id" value="${composantInstance?.composants*.id}" />

We have 150 options in the select list, all options selected after the 50th order are not saved in database. It's annoying. We know that if the multiple attribute is at true the ZKUI select component uses Listbox ZK Component.

We are available to provide you more elements

Thanks in advance

velo6raptor commented 11 years ago

Could you answer please ? it's urgent for us to solve this issue

xiaochong commented 11 years ago

Sorry my reply so late, I am so busying my work!

Could you provide a demo?

hasMany support in zkui is not very good, but it's easy to hack it use Checkbox or Listbox,

You can get the value of Checkbox or Listbox in your Composer

View

<zkui:select name="itemList" multiple="true" checkmark="true" optionKey="id" optionValue="name"

Composer

class YourComposer {
  Listbox itemList

  void onClick_button(Event e){
     def ids=itemList.getItems().value // the id list of domain Item

      // use ids to handle your domain
  }
velo6raptor commented 11 years ago

Hi,

I added this line in the onClick_button to show the content of the Listbox

Messagebox.show("Composants ids="+composants.getItems().value)

and I have the following message, we note that several values ​​are null

Composants ids=[41, 272, 273, 2, 279, 274, 241, 46, 282, 281, 259, 51, 111, 49, 122, 112, 278, 245, 251, 246, 265, 30, 115, 116, 260, 57, 11, 117, 118, 119, 229, 120, 31, 124, 165, 126, 127, 237, 128, 43, 129, 130, 131, 132, 134, 135, 101, 269, 100, 136, 19, 137, 138, 102, 139, 12, 6, 140, 17, 141, 1, 242, 243, 234, 45, 53, 231, 29, 142, 143, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 108, 186, 254, 253, 187, 123, 248, 188, 33, 189, 190, 283, 191, 192, 193, 194, 195, 196, 197, 262, null, null, 14, 105, 257, 247, 200, 201, 16, 202, 268, 48, 198, 99, 106, 203, 204, 255, 206]

we can also say that the range of zero values ​​slightly vary or disappear randomly

We have too this error message when we save record :

Un autre utilisateur a mis à jour ce Composant pendant votre édition

Thanks in advance

velo6raptor commented 11 years ago

Find below the view code of the select list

<zkui:select name="composants" height="400px" from="${vdo.catapp.Composant.findAll("from Composant where actif=true order by libelle")}" multiple="true" checkmark="true" optionKey="id" width="300px" value="${composantInstance?.composants*.id}" />

velo6raptor commented 11 years ago

zkui:select name="composants" height="400px" from="${vdo.catapp.Composant.findAll("from Composant where actif=true order by libelle")}" multiple="true" checkmark="true" optionKey="id" width="300px" value="${composantInstance?.composants*.id}"

velo6raptor commented 11 years ago

Hi I solved this problem by using a tree component Nevertheless, there is indeed a bug int the zkui select component to correct Thanks in advance