You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by olip <ol...@googlemail.com> on 2010/08/05 13:51:57 UTC

Grids embedded in custom component interfer with each other

Hi!

I have a problem or suggestion.

I have made a custom component which has a Grid embedded.

Now I render multiple times my cusom components.

The GridPager of those rendered Grids interfer with each other.
If I click on one Grip page the others will be changed too.

If I look into the html code I see that the grid Id for all rendered grids
is the same.

So I extended the Grid java class by adding a parameter clientId which will
be the div id of the grid
and I assign it my component id from which this is embedded.

Now it works!
Is there another way to deal with this problem or should I submit a
bug/feature request for the grid class?

Thanks Oli
-- 
View this message in context: http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5376183.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grids embedded in custom component interfer with each other

Posted by olip <ol...@googlemail.com>.
thanks for confirming.

This seems like a serious bug and you do not need to put the grids in
components to see this not working.

If you have several grids without components on the same page the
pagerenderers do interfer each other as well!
-- 
View this message in context: http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5379999.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grids embedded in custom component interfer with each other

Posted by Sven Homburg <ho...@googlemail.com>.
hmm, same as here,
the grid/gridpager dont become an unique id

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2010/8/5 olip <ol...@googlemail.com>

>
> Hi here is a test code:
>
> =======
> EmbeddedGrid.tml:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>      xmlns:p="tapestry:parameter">
>    <head>
>        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>        <title>embeddedgrid</title>
>    </head>
>    <body>
>       <t:grid source="numbers" row="numLoop"/>
>
>
>    </body>
>   </html>
>
>
> =======
>
> EmbeddedGrid.java
>
> public class EmbeddedGrid {
>
>
>    @Persist
>    @Property
>    private ArrayList<Number> numbers;
>
>    @Property
>    private Number numLoop;
>
>    @Parameter(required=true)
>    private int max;
>
>    @SetupRender
>    public void setupRendering() {
>         numbers = new ArrayList<Number>();
>         for(int i=0;i<max;i++) {
>             numbers.add(new Number(i));
>         }
>    }
>
>
>
>    public class Number {
>        int id;
>        int randNum;
>
>        public Number(int id) {
>            id = id;
>            randNum=(new Random()).nextInt();
>        }
>
>        public int getId() {
>            return id;
>        }
>
>        public void setId(int id) {
>            this.id = id;
>        }
>
>        public int getRandNum() {
>            return randNum;
>        }
>
>        public void setRandNum(int randNum) {
>            this.randNum = randNum;
>        }
>    }
>
>
>
>
>
>
>
> }
>
>
> =======
>
> TestEmbeddedGrid.tml
>
> <html t:type="layout" title="gridTest Index"
>      t:sidebarTitle="Current Time"
>      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>      xmlns:p="tapestry:parameter">
>
>    <t:loop source="numberGrids" value="loopgridMember">
>        <t:embeddedGrid max="loopgridMember"/>
>
>    </t:loop>
>
>
> </html>
>
> =======
> TestEmbeddedGrid.java
> public class TestEmbeddedGrid {
>
>    @Property
>    @Persist
>    private ArrayList<Integer> numberGrids;
>
>    @Property
>    private Integer loopGridMember;
>
>
>    @SetupRender
>    public void onSetupRendering() {
>        numberGrids=new ArrayList<Integer>();
>        //draw 15 grids
>        int amountRandNum = 15;//+((new Random()).nextInt())%30;
>        //dynamic row content of each grid
>        for(int i = 0 ; i < amountRandNum ; i++) {
>            numberGrids.add(50+new Random().nextInt()%100);
>        }
>    }
> }
>
>
> =======
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5376353.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Grids embedded in custom component interfer with each other

Posted by olip <ol...@googlemail.com>.
Hi here is a test code:

=======
EmbeddedGrid.tml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns:p="tapestry:parameter">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>embeddedgrid</title>
    </head>
    <body>
       <t:grid source="numbers" row="numLoop"/>   


    </body>
   </html>


=======

EmbeddedGrid.java

public class EmbeddedGrid {


    @Persist
    @Property
    private ArrayList<Number> numbers;

    @Property
    private Number numLoop;

    @Parameter(required=true)
    private int max;

    @SetupRender
    public void setupRendering() {
         numbers = new ArrayList<Number>(); 
         for(int i=0;i<max;i++) {
             numbers.add(new Number(i));
         }
    }



    public class Number {
        int id;
        int randNum;

        public Number(int id) {
            id = id;
            randNum=(new Random()).nextInt();
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public int getRandNum() {
            return randNum;
        }

        public void setRandNum(int randNum) {
            this.randNum = randNum;
        }
    }







}


=======

TestEmbeddedGrid.tml

<html t:type="layout" title="gridTest Index"
      t:sidebarTitle="Current Time"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns:p="tapestry:parameter">

    <t:loop source="numberGrids" value="loopgridMember">
        <t:embeddedGrid max="loopgridMember"/>

    </t:loop>


</html>

=======
TestEmbeddedGrid.java
public class TestEmbeddedGrid {

    @Property
    @Persist
    private ArrayList<Integer> numberGrids;

    @Property
    private Integer loopGridMember;


    @SetupRender
    public void onSetupRendering() {
        numberGrids=new ArrayList<Integer>();
        //draw 15 grids
        int amountRandNum = 15;//+((new Random()).nextInt())%30;
        //dynamic row content of each grid
        for(int i = 0 ; i < amountRandNum ; i++) {
            numberGrids.add(50+new Random().nextInt()%100);
        }
    }
}


=======
-- 
View this message in context: http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5376353.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grids embedded in custom component interfer with each other

Posted by Sven Homburg <ho...@googlemail.com>.
let us see you component code/template

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2010/8/5 olip <ol...@googlemail.com>

>
> Hi!
>
> I have a problem or suggestion.
>
> I have made a custom component which has a Grid embedded.
>
> Now I render multiple times my cusom components.
>
> The GridPager of those rendered Grids interfer with each other.
> If I click on one Grip page the others will be changed too.
>
> If I look into the html code I see that the grid Id for all rendered grids
> is the same.
>
> So I extended the Grid java class by adding a parameter clientId which will
> be the div id of the grid
> and I assign it my component id from which this is embedded.
>
> Now it works!
> Is there another way to deal with this problem or should I submit a
> bug/feature request for the grid class?
>
> Thanks Oli
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5376183.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Grids embedded in custom component interfer with each other

Posted by sprabhu <sh...@gmail.com>.

-- 
View this message in context: http://tapestry-users.832.n2.nabble.com/Grids-embedded-in-custom-component-interfer-with-each-other-tp5376183p5838045.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org