Salut,
Voila j'ai deux selectOneMenus, un pour une liste de catégories, un autre pour une liste de sous-catégories et j'essaie de rafraichir et filtrer ma liste de sous-catégories à la sélection d'une catégorie.
J'arrive bien a lancer ma méthode refreshSubTypeList() mais ma liste de sous-catégorie n'est pas actualisée.
JSP:
Bean:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 <h:form> ... <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Catégorie</ui:define> <h:selectOneMenu id="productType" rendered="#{not empty typeList.resultList}" value="#{productList.product.productSubType.subTypeType.typeId}"> <s:selectItems value="#{typeList.resultList}" var="type" label="#{type.typeName}" itemValue="#{type.typeId}" noSelectionLabel=""/> <a4j:support event="onchange" reRenderAfterComplete="productSubType" action="#{productList.refreshSubTypeList}"/> </h:selectOneMenu> </s:decorate> <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Sous catégorie</ui:define> <h:selectOneMenu id="productSubType" rendered="#{not empty productList.checkSubTypeList.resultList}" value="#{productList.product.productSubType.subTypeId}"> <s:selectItems value="#{productList.subTypeList.resultList}" var="subType" label="#{subType.subTypeName}" itemValue="#{subType.subTypeId}" noSelectionLabel="" /> </h:selectOneMenu> </s:decorate> ... </h:form>
Message console à l'ouverture de la page:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 @Name("productList") @Scope(ScopeType.SESSION) public class ProductList extends EntityQuery<Product> { ... @In(create = true) SubTypeList subTypeList; ... public SubTypeList getSubTypeList() { System.out.println("get subType list <<<<<<<<<<<<<<<<<<<<"); System.out.println("subType list current count filter: "+subTypeList.getResultCount()); System.out.println("end get subType list --"); return subTypeList; } public SubTypeList getCheckSubTypeList() { System.out.println("check subType list ???????????????????"); System.out.println("subType list current count filter: "+subTypeList.getResultCount()); System.out.println("end check subType list --"); return subTypeList; } @SuppressWarnings("unchecked") public void refreshSubTypeList() { System.out.println("refresh subType list ******************"); System.out.println("-> id Type:"+product.getProductSubType().getSubTypeType().getTypeId()); if(product.getProductSubType().getSubTypeType().getTypeId()==null){ System.out.println("no restrictions"); List<ValueExpression> restrictions = subTypeList.getRestrictions(); for (ValueExpression valueExpression : restrictions) { System.out.println("vExp: "+valueExpression.getExpressionString() ); } subTypeList.setRestrictions(new ArrayList<ValueExpression>()); } else { System.out.println("restrictions"); List<ValueExpression> restrictions = new ArrayList<ValueExpression>(); restrictions.add(createValueExpression("subType.subTypeType.typeId = #{productList.product.productSubType.subTypeType.typeId}")); subTypeList.setRestrictions(restrictions); System.out.println("updated restrictions"); } //subTypeList.refresh(); System.out.println("refresh subType list end count filter: "+subTypeList.getResultCount()); } }
On voit bien que le INFO [STDOUT] get subType list <<<<<<<<<<<<<<<<<<<< qui montre que l'on rempli les items de la liste des sous-catégorie.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 11:33:51,873 INFO [STDOUT] Hibernate: select type0_.typeId as typeId150_, type0_.typeName as typeName150_ from evercat.type type0_ limit ? 11:33:51,881 INFO [STDOUT] check subType list ??????????????????? 11:33:51,882 INFO [STDOUT] Hibernate: select count(subtype0_.subTypeId) as col_0_0_ from evercat.subType subtype0_ limit ? 11:33:51,883 INFO [STDOUT] subType list current count filter: 3 11:33:51,883 INFO [STDOUT] end check subType list -- 11:33:51,884 INFO [STDOUT] Hibernate: select subtype0_.subTypeId as subTypeId140_, subtype0_.subTypeName as subTypeN2_140_, subtype0_.typeId as typeId140_ from evercat.subType subtype0_ limit ? 11:33:51,886 INFO [STDOUT] check subType list ??????????????????? 11:33:51,886 INFO [STDOUT] subType list current count filter: 3 11:33:51,886 INFO [STDOUT] end check subType list -- 11:33:51,887 INFO [STDOUT] check subType list ??????????????????? 11:33:51,888 INFO [STDOUT] subType list current count filter: 3 11:33:51,888 INFO [STDOUT] end check subType list -- 11:33:51,889 INFO [STDOUT] check subType list ??????????????????? 11:33:51,889 INFO [STDOUT] subType list current count filter: 3 11:33:51,889 INFO [STDOUT] end check subType list -- 11:33:51,890 INFO [STDOUT] check subType list ??????????????????? 11:33:51,890 INFO [STDOUT] subType list current count filter: 3 11:33:51,890 INFO [STDOUT] end check subType list -- 11:33:51,891 INFO [STDOUT] check subType list ??????????????????? 11:33:51,892 INFO [STDOUT] subType list current count filter: 3 11:33:51,892 INFO [STDOUT] end check subType list -- 11:33:51,893 INFO [STDOUT] check subType list ??????????????????? 11:33:51,893 INFO [STDOUT] subType list current count filter: 3 11:33:51,893 INFO [STDOUT] end check subType list -- 11:33:51,894 INFO [STDOUT] check subType list ??????????????????? 11:33:51,894 INFO [STDOUT] subType list current count filter: 3 11:33:51,894 INFO [STDOUT] end check subType list -- 11:33:51,895 INFO [STDOUT] check subType list ??????????????????? 11:33:51,896 INFO [STDOUT] subType list current count filter: 3 11:33:51,896 INFO [STDOUT] end check subType list -- 11:33:51,896 INFO [STDOUT] check subType list ??????????????????? 11:33:51,897 INFO [STDOUT] subType list current count filter: 3 11:33:51,897 INFO [STDOUT] end check subType list -- 11:33:51,899 INFO [STDOUT] get subType list <<<<<<<<<<<<<<<<<<<< 11:33:51,899 INFO [STDOUT] subType list current count filter: 3 11:33:51,899 INFO [STDOUT] end get subType list -- 11:33:51,900 INFO [STDOUT] check subType list ??????????????????? 11:33:51,901 INFO [STDOUT] subType list current count filter: 3 11:33:51,901 INFO [STDOUT] end check subType list -- 11:33:51,902 INFO [STDOUT] check subType list ??????????????????? 11:33:51,902 INFO [STDOUT] subType list current count filter: 3 11:33:51,902 INFO [STDOUT] end check subType list --
Message console sur une sélection d'une catégorie:
Ici la méthode refreshSubTypeList() est bien appellée mais aucun appel à getSubTypeList() pourtant on abien les appels à checkSubTypeList()?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 11:36:04,616 INFO [STDOUT] Hibernate: select type0_.typeId as typeId150_, type0_.typeName as typeName150_ from evercat.type type0_ limit ? 11:36:04,620 INFO [STDOUT] check subType list ??????????????????? 11:36:04,621 INFO [STDOUT] Hibernate: select count(subtype0_.subTypeId) as col_0_0_ from evercat.subType subtype0_ limit ? 11:36:04,622 INFO [STDOUT] subType list current count filter: 3 11:36:04,622 INFO [STDOUT] end check subType list -- 11:36:04,624 INFO [STDOUT] Hibernate: select subtype0_.subTypeId as subTypeId140_, subtype0_.subTypeName as subTypeN2_140_, subtype0_.typeId as typeId140_ from evercat.subType subtype0_ limit ? 11:36:04,626 INFO [STDOUT] check subType list ??????????????????? 11:36:04,626 INFO [STDOUT] subType list current count filter: 3 11:36:04,626 INFO [STDOUT] end check subType list -- 11:36:04,638 INFO [STDOUT] check subType list ??????????????????? 11:36:04,638 INFO [STDOUT] subType list current count filter: 3 11:36:04,638 INFO [STDOUT] end check subType list -- 11:36:04,639 INFO [STDOUT] check subType list ??????????????????? 11:36:04,639 INFO [STDOUT] subType list current count filter: 3 11:36:04,639 INFO [STDOUT] end check subType list -- 11:36:04,649 INFO [STDOUT] check subType list ??????????????????? 11:36:04,650 INFO [STDOUT] subType list current count filter: 3 11:36:04,650 INFO [STDOUT] end check subType list -- 11:36:04,650 INFO [STDOUT] check subType list ??????????????????? 11:36:04,651 INFO [STDOUT] subType list current count filter: 3 11:36:04,651 INFO [STDOUT] end check subType list -- 11:36:04,659 INFO [STDOUT] refresh subType list ****************** 11:36:04,659 INFO [STDOUT] -> id Type:1 11:36:04,659 INFO [STDOUT] restrictions 11:36:04,659 INFO [STDOUT] updated restrictions 11:36:04,662 INFO [STDOUT] Hibernate: select count(subtype0_.subTypeId) as col_0_0_ from evercat.subType subtype0_ where subtype0_.typeId=? limit ? 11:36:04,662 INFO [STDOUT] refresh subType list end count filter: 2 11:36:04,679 INFO [STDOUT] check subType list ??????????????????? 11:36:04,680 INFO [STDOUT] subType list current count filter: 2 11:36:04,680 INFO [STDOUT] end check subType list -- 11:36:04,682 INFO [STDOUT] Hibernate: select subtype0_.subTypeId as subTypeId140_, subtype0_.subTypeName as subTypeN2_140_, subtype0_.typeId as typeId140_ from evercat.subType subtype0_ where subtype0_.typeId=? limit ?
Message console sur une sélection d'une autre catégorie:
Ici je comprends encore moins la taille de la liste subTypeList devrait être à 2 au début et non à 3, compte tenue de la dernière sélection.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 11:36:04,616 INFO [STDOUT] Hibernate: select type0_.typeId as typeId150_, type0_.typeName as typeName150_ from evercat.type type0_ limit ? 11:36:04,620 INFO [STDOUT] check subType list ??????????????????? 11:36:04,621 INFO [STDOUT] Hibernate: select count(subtype0_.subTypeId) as col_0_0_ from evercat.subType subtype0_ limit ? 11:36:04,622 INFO [STDOUT] subType list current count filter: 3 11:36:04,622 INFO [STDOUT] end check subType list -- 11:36:04,624 INFO [STDOUT] Hibernate: select subtype0_.subTypeId as subTypeId140_, subtype0_.subTypeName as subTypeN2_140_, subtype0_.typeId as typeId140_ from evercat.subType subtype0_ limit ? 11:36:04,626 INFO [STDOUT] check subType list ??????????????????? 11:36:04,626 INFO [STDOUT] subType list current count filter: 3 11:36:04,626 INFO [STDOUT] end check subType list -- 11:36:04,638 INFO [STDOUT] check subType list ??????????????????? 11:36:04,638 INFO [STDOUT] subType list current count filter: 3 11:36:04,638 INFO [STDOUT] end check subType list -- 11:36:04,639 INFO [STDOUT] check subType list ??????????????????? 11:36:04,639 INFO [STDOUT] subType list current count filter: 3 11:36:04,639 INFO [STDOUT] end check subType list -- 11:36:04,649 INFO [STDOUT] check subType list ??????????????????? 11:36:04,650 INFO [STDOUT] subType list current count filter: 3 11:36:04,650 INFO [STDOUT] end check subType list -- 11:36:04,650 INFO [STDOUT] check subType list ??????????????????? 11:36:04,651 INFO [STDOUT] subType list current count filter: 3 11:36:04,651 INFO [STDOUT] end check subType list -- 11:36:04,659 INFO [STDOUT] refresh subType list ****************** 11:36:04,659 INFO [STDOUT] -> id Type:2 11:36:04,659 INFO [STDOUT] restrictions 11:36:04,659 INFO [STDOUT] updated restrictions 11:36:04,662 INFO [STDOUT] Hibernate: select count(subtype0_.subTypeId) as col_0_0_ from evercat.subType subtype0_ where subtype0_.typeId=? limit ? 11:36:04,662 INFO [STDOUT] refresh subType list end count filter: 1 11:36:04,679 INFO [STDOUT] check subType list ??????????????????? 11:36:04,680 INFO [STDOUT] subType list current count filter: 1 11:36:04,680 INFO [STDOUT] end check subType list -- 11:36:04,682 INFO [STDOUT] Hibernate: select subtype0_.subTypeId as subTypeId140_, subtype0_.subTypeName as subTypeN2_140_, subtype0_.typeId as typeId140_ from evercat.subType subtype0_ where subtype0_.typeId=? limit ?
Alors la je suis largué![]()
Aidez moi s'il vous plait
Mon environnement:
jboss-seam-2.2.0.GA
jboss-5.1.0.GA
Partager