Extending the DataTable class doesnt work

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

Extending the DataTable class doesnt work

chathuraka.waas
Hi,

i'm trying to migrate my application from 1.4 to 6.14. i have a class extending the DataTable and it seems not working after the migration.

i tried replacing the extended class with the DataTable class and it worked fine.

this is my code for extending the DataTable class.

public class TestTable<T,Object> extends DataTable<T,Object> {
       
        private static final long serialVersionUID = 1L;


        public TestTable(String id, List<IColumn<T, Object>> columns, IDataProvider<T> dataProvider, int rowsPerPage) {
                super(id, columns, dataProvider, rowsPerPage);
        }

}

am i doing something wrong here. please shed some light on this. Thanks in advance.

Regards,
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
Hi,

Again I have problems identifying the description of the problem in your
mails.
"it seems not working" doesn't say anything. Just avoid using such
statements.
Better add info about what is expected and what is the actual result.

Next time I will just ignore your mail.

Martin Grigorov
Wicket Training and Consulting


On Fri, Mar 14, 2014 at 6:53 AM, chathuraka.waas
<[hidden email]>wrote:

> Hi,
>
> i'm trying to migrate my application from 1.4 to 6.14. i have a class
> extending the DataTable and it seems not working after the migration.
>
> i tried replacing the extended class with the DataTable class and it worked
> fine.
>
> this is my code for extending the DataTable class.
>
> public class TestTable<T,Object> extends DataTable<T,Object> {
>

Here you shadow a real type - java.lang.Object.
It is not problem per se, but it is very easy to become such.


>
>         private static final long serialVersionUID = 1L;
>
>
>         public TestTable(String id, List<IColumn&lt;T, Object>> columns,
> IDataProvider<T> dataProvider, int rowsPerPage) {
>                 super(id, columns, dataProvider, rowsPerPage);
>         }
>
> }
>
> am i doing something wrong here. please shed some light on this. Thanks in
> advance.
>
> Regards,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Ernesto Reinaldo Barreiro-4
In reply to this post by chathuraka.waas
Hi,

I just remember at some point there were some incompatible changes on
DataTable: remember having to adjust the markup of an extension to get it
working again...

But as Martin states, your mail is not very helpful as you don't clearly
state what the problem is: class does not compile?, you get an exception at
runtime? If so, stackrace? Help other help you, and value their time.


On Fri, Mar 14, 2014 at 5:53 AM, chathuraka.waas
<[hidden email]>wrote:

> Hi,
>
> i'm trying to migrate my application from 1.4 to 6.14. i have a class
> extending the DataTable and it seems not working after the migration.
>
> i tried replacing the extended class with the DataTable class and it worked
> fine.
>
> this is my code for extending the DataTable class.
>
> public class TestTable<T,Object> extends DataTable<T,Object> {
>
>         private static final long serialVersionUID = 1L;
>
>
>         public TestTable(String id, List<IColumn&lt;T, Object>> columns,
> IDataProvider<T> dataProvider, int rowsPerPage) {
>                 super(id, columns, dataProvider, rowsPerPage);
>         }
>
> }
>
> am i doing something wrong here. please shed some light on this. Thanks in
> advance.
>
> Regards,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Regards - Ernesto Reinaldo Barreiro
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

chathuraka.waas
Hi Thanks for your replies.

what i ment from not working was it doesnt give any compilation errors or runtime errors but simply it doesnt show the table as in the html.

I tried implementing the basics of DataTable just to try out. here's my code.

List<IColumn<TestData,String>> columns = new ArrayList<IColumn<TestData,String>>();
       
columns.add(new PropertyColumn<TestData, String>(new Model<String>("Name"), "o.name")
        {
            @Override
            public String getCssClass()
            {
                return "sampleCss";
            }
        });

table = new DefaultDataTable<OfferData, String>("OffersTable",columns,dataProvider,5);
table.setOutputMarkupId(true);
table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, dataProvider));

i have this code inside a panel and i'm adding the panel to my page. when i inspected the generated html i cant find any tabel elements. the column headers are shown inside span tags.  and also the css classes are not applied to the columns as well.

what am i doing wrong in here.
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
Show us the markup of the panel where this table is added please.

Martin Grigorov
Wicket Training and Consulting


On Fri, Mar 14, 2014 at 10:09 AM, chathuraka.waas <[hidden email]
> wrote:

> Hi Thanks for your replies.
>
> what i ment from not working was it doesnt give any compilation errors or
> runtime errors but simply it doesnt show the table as in the html.
>
> I tried implementing the basics of DataTable just to try out. here's my
> code.
>
> List<IColumn&lt;TestData,String>> columns = new
> ArrayList<IColumn&lt;TestData,String>>();
>
> columns.add(new PropertyColumn<TestData, String>(new Model<String>("Name"),
> "o.name")
>         {
>             @Override
>             public String getCssClass()
>             {
>                 return "sampleCss";
>             }
>         });
>
> table = new DefaultDataTable<OfferData,
> String>("OffersTable",columns,dataProvider,5);
> table.setOutputMarkupId(true);
> table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, dataProvider));
>
> i have this code inside a panel and i'm adding the panel to my page. when i
> inspected the generated html i cant find any tabel elements. the column
> headers are shown inside span tags.  and also the css classes are not
> applied to the columns as well.
>
> what am i doing wrong in here.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4664956.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

chathuraka.waas
hi,

this is my markup for the panel

<wicket:panel xmlns:wicket="http://wicket.apache.org/">
        <div wicket:id="OffersTable"></div>
</wicket:panel>

and the generated markup is this,
        <div id="id28" class="offer-type-panel">
               <div id="id29">
                   Name
                   Name
                   <div>No Records Found</div>
                   <div class="navigatorLabel">
                   <div class="navigator">
               </div>
        </div>

Regards,
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
On Fri, Mar 14, 2014 at 10:30 AM, chathuraka.waas <[hidden email]
> wrote:

> hi,
>
> this is my markup for the panel
>
> <wicket:panel xmlns:wicket="http://wicket.apache.org/">
>         <div wicket:id="OffersTable"></div>
>

change <div> to <table>

I am not sure why Wicket allows this.
DataTable can check the name of its tag and throw exception when it is not
table ...


> </wicket:panel>
>
> and the generated markup is this,
>         <div id="id28" class="offer-type-panel">
>                <div id="id29">
>                    Name
>                    Name
>                    <div>No Records Found</div>
>                    <div class="navigatorLabel">
>                    <div class="navigator">
>                </div>
>         </div>
>
> Regards,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4664958.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
https://issues.apache.org/jira/browse/WICKET-5534

Martin Grigorov
Wicket Training and Consulting


On Fri, Mar 14, 2014 at 10:33 AM, Martin Grigorov <[hidden email]>wrote:

>
>
> On Fri, Mar 14, 2014 at 10:30 AM, chathuraka.waas <
> [hidden email]> wrote:
>
>> hi,
>>
>> this is my markup for the panel
>>
>> <wicket:panel xmlns:wicket="http://wicket.apache.org/">
>>         <div wicket:id="OffersTable"></div>
>>
>
> change <div> to <table>
>
> I am not sure why Wicket allows this.
> DataTable can check the name of its tag and throw exception when it is not
> table ...
>
>
>> </wicket:panel>
>>
>> and the generated markup is this,
>>         <div id="id28" class="offer-type-panel">
>>                <div id="id29">
>>                    Name
>>                    Name
>>                    <div>No Records Found</div>
>>                    <div class="navigatorLabel">
>>                    <div class="navigator">
>>                </div>
>>         </div>
>>
>> Regards,
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4664958.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

chathuraka.waas
Got the basic datatable to show in the page. Thanks Martin.
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

chathuraka.waas
hi,

i'm still trying to fix my initial issue where i have a customized DataTable class. I have a panel and inside that i have the table i'm extended from the Data Table.

the code for my extended table is this.

public class OfferTable<T,S> extends DataTable<T,S> {
       
        private static final long serialVersionUID = 1L;


        public OfferTable(String id, List<IColumn<T, S>> columns, IDataProvider<T> dataProvider, int rowsPerPage) {
                super(id, columns, dataProvider, rowsPerPage);
        }

}


and i have the corresponding markup file for this class.

<wicket:panel xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=blob_plain;f=wicket-core/src/main/resources/META-INF/wicket-1.5.xsd;hb=master">
   
                            <wicket:container wicket:id="topToolbars"></wicket:container>
                                <tfoot>
                        <wicket:container wicket:id="bottomToolbars" class="fan-nav"></wicket:container>
        </tfoot>
                                                                                                                           
       
                                        [cell]
                               
<div class="last-row-bottom-border"></div>
</wicket:panel>


i'm creating a instance out of this Table class and placing it in my panel.

List<IColumn<OfferData, String>> columns = new ArrayList<IColumn<OfferData, String>>();
        columns.add(name);
        columns.add(fans);
 
table = new OfferTable<OfferData,String>("OffersTable", columns, dataProvider, 5) {
       
            private static final long serialVersionUID = 8235090332329499560L;

            @Override
            protected Item newRowItem(String id, int index, IModel model) {
                Item item = new Item(id, index, model);
                item.add(new AttributeModifier("class", new Model<String>(index % 2 == 0 ? "current"
                        : "altrow")));
                return item;
            }
        };


table.setOutputMarkupId(true);
table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, dataProvider));


when  i do this the table does not gets generated. i cant find any compile time errors or runtime errors.
what am i doing wrong in here.



 
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
On Fri, Mar 14, 2014 at 11:42 AM, chathuraka.waas <[hidden email]
> wrote:

> hi,
>
> i'm still trying to fix my initial issue where i have a customized
> DataTable
> class. I have a panel and inside that i have the table i'm extended from
> the
> Data Table.
>
> the code for my extended table is this.
>
> public class OfferTable<T,S> extends DataTable<T,S> {
>
>         private static final long serialVersionUID = 1L;
>
>
>         public OfferTable(String id, List<IColumn&lt;T, S>> columns,
> IDataProvider<T> dataProvider, int rowsPerPage) {
>                 super(id, columns, dataProvider, rowsPerPage);
>         }
>
> }
>
>
> and i have the corresponding markup file for this class.
>
> <wicket:panel xmlns="http://www.w3.org/1999/xhtml"
> xmlns:wicket="
> http://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=blob_plain;f=wicket-core/src/main/resources/META-INF/wicket-1.5.xsd;hb=master
> ">


>
>
>
>             <wicket:container wicket:id="topToolbars"></wicket:container>
>
>                 <tfoot>
>                         <wicket:container wicket:id="bottomToolbars"
> class="fan-nav"></wicket:container>
>         </tfoot>
>
>
>
>
>                                         [cell]
>
>
>
> <div class="last-row-bottom-border"></div>


> </wicket:panel>
>

The DataTable (the Panel) is used with <table> HTML element.
<table> can look like:
<table>
   <tr><td></td></tr>
</table>

or
<table>
<thead><tr><th></th></tr></thead>
<tbody><tr><td></td></tr></tbody>
<tfoot><tr><td></td></tr></tfoot>

With your markup you create invalid HTML.
I guess this is the reason why the browser doesn't render it.


>
> i'm creating a instance out of this Table class and placing it in my panel.
>
> List<IColumn&lt;OfferData, String>> columns = new
> ArrayList<IColumn&lt;OfferData, String>>();
>         columns.add(name);
>         columns.add(fans);
>
> table = new OfferTable<OfferData,String>("OffersTable", columns,
> dataProvider, 5) {
>
>             private static final long serialVersionUID =
> 8235090332329499560L;
>
>             @Override
>             protected Item newRowItem(String id, int index, IModel model) {
>                 Item item = new Item(id, index, model);
>                 item.add(new AttributeModifier("class", new
> Model<String>(index % 2 == 0 ? "current"
>                         : "altrow")));
>                 return item;
>             }
>         };
>
>
> table.setOutputMarkupId(true);
> table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, dataProvider));
>
>
> when  i do this the table does not gets generated. i cant find any compile
> time errors or runtime errors.
> what am i doing wrong in here.
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4664962.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

chathuraka.waas
This post was updated on .
hi,

thanks for your reply. I tried making the <div> to a  element in the panel markup.

<wicket:panel xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=blob_plain;f=wicket-core/src/main/resources/META-INF/wicket-1.5.xsd;hb=master">
       
</wicket:panel>

it didnt work out.

then i tried removing the outer panel elements from the OfferTable.html markup and it gave an runtime error asking for the panel markup element.


                    <wicket:container wicket:id="topToolbars"></wicket:container>
                                                                     
                <tfoot>
            <wicket:container wicket:id="bottomToolbars" class="fan-nav"></wicket:container>
        </tfoot>
   
                    [cell]
               
<div class="last-row-bottom-border"></div>

as i tried earlier just placing the table content inside the panel and using DataTable gets me the work done. but i'm trying to use this method since there are few other places which uses this code.

Regards,
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
On Fri, Mar 14, 2014 at 12:10 PM, chathuraka.waas <[hidden email]
> wrote:

> hi,
>
> thanks for your reply. I tried making the <div> to a
>  element in the panel markup.
>
> <wicket:panel xmlns="http://www.w3.org/1999/xhtml"
> xmlns:wicket="
> http://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=blob_plain;f=wicket-core/src/main/resources/META-INF/wicket-1.5.xsd;hb=master
> ">
>
>
> </wicket:panel>
>

just remove OfferTable.html completely


>
> it didnt work out.
>
> then i tried removing the outer panel elements from the OfferTable.html
> markup and it gave an runtime error asking for the panel markup element.
>
>
>
>
>             <wicket:container wicket:id="topToolbars"></wicket:container>
>
>
>
>
>
>                     [cell]
>
>
>
> <div class="last-row-bottom-border"></div>
>

You cannot have a <div> inside <table>.
The <div> can be inside a <td>.


>
>         <tfoot>
>             <wicket:container wicket:id="bottomToolbars"
> class="fan-nav"></wicket:container>
>         </tfoot>
>
>
>
> as i tried earlier just placing the table content inside the panel and
> using
> DataTable gets me the work done. but i'm trying to use this method since
> there are few other places which uses this code.
>
> Regards,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4664965.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

                                                                                           
but with wicket 6.14 i'm unable to do this. when i place wicket elements inside the table it complains telling that only row html elements are allowed inside a table component.

my current table mark up is this,

 
chathuraka.waas
Hi,

i'm still trying to fix my issue. Even though most of the issues are fixed there is one small glitch i cant get my way around.

Given my business scenario i need to be able to add a empty row to the table after its been rendered by wicket.

In wicket 1.4 this was achieved by,

                                        [cell]
                               
<div class="last-row-bottom-border"></div>
 

how can i achieve to add a empty column after the rows are being rendered in wicket 6.14.

Thanks in advance.

Regards,
Reply | Threaded
Open this post in threaded view
|

Re: Extending the DataTable class doesnt work

Martin Grigorov-4
Hi,

In MyDataTable.html you need to add either a second <tr> in the <tbody>, or
a second <tbody> for this extra row.
As I said earlier <div> is not allowed in <table>, <tbody> and <tr>
elements.

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 19, 2014 at 7:11 AM, chathuraka.waas
<[hidden email]>wrote:

> Hi,
>
> i'm still trying to fix my issue. Even though most of the issues are fixed
> there is one small glitch i cant get my way around.
>
> Given my business scenario i need to be able to add a empty row to the
> table
> after its been rendered by wicket.
>
> In wicket 1.4 this was achieved by,
>
>
>
>
>
>                                         [cell]
>
>
>
> <div class="last-row-bottom-border"></div>
>
>
> but with wicket 6.14 i'm unable to do this. when i place wicket elements
> inside the table it complains telling that only row html elements are
> allowed inside a table component.
>
> my current table mark up is this,
>
>
>
>
>
> how can i achieve to add a empty column after the rows are being rendered
> in
> wicket 6.14.
>
> Thanks in advance.
>
> Regards,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952p4665018.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>