You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lurtz Nazgul <lu...@ymail.com> on 2011/07/21 14:06:13 UTC

dynamic DataTable

Hi,

How can we create a dynamic DataTable which has dynamic Columns? I want to 
create a page that has following components:
- A TextArea for SQL Statement input (User will type any SELECT Sql here)
- A Submit button to run the SQL
- A Table to view the SQL Resultset.

Since TextArea can contain any SELECT statement, Column names, count can  change 
every time. So I need a dynamic table that is compatible to view  any SELECT 
Statement result.

How can I simply do this in Wicket?

Thanks a lot,
Regards,

Re: dynamic DataTable

Posted by Josh Kamau <jo...@gmail.com>.
wickets AjaxFallbackDefaultDatatable is my favourite component.

Josh

On 21 Jul 2011 17:23, "Martin Grigorov" <mg...@apache.org> wrote:

Am I that old or .NET is younger than 10 years ?

First tell me what is so complex with wicket-extensions DataTable and
I'll tell you how to do it ;-)

You *need* to extract the DB meta data if you want the dynamics.
Wicket is web framework, not common data extraction framework.
Once you have the column names then you can create the
List<IColumn<Entity>> and IDataProvider<Entity> needed by DataTable.
>From there on Wicket will create the table for you.

So if you do the "easy" part to extract the columns meta data then
give it to me and I'll do the "hard" part to dress it in a DataTable
;-)


On Thu, Jul 21, 2011 at 5:08 PM, davut uysal <da...@gmail.com> wrote:
> Yeah, I agree there must ...
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users...

Re: dynamic DataTable

Posted by Clint Checketts <ch...@gmail.com>.
Sorry for taking 2 weeks. Here is a quick and dirty implementation:
https://github.com/checketts/wicket-datasource-table

It needs a bit of cleanup. 2 points that I like to note is 1) the use of a
datasource instead of a java.sql.Connection will allow automatically opening
and closing connections (so the table provider will manage itself and 2) the
use of the ResultSetMetaData to grab the column names and count.

I'll try to get around to cleaning it up (patches are welcome!) but since I
hadn't improved it in the last 5 days I figured I should just get it out
there in it rough cut glory. Its using H2 right now for the JDBC backend,
but you'd be able to switch out any equivalent driver.

-Clint

On Sat, Jul 23, 2011 at 10:18 AM, davut uysal <da...@gmail.com> wrote:

> Thanks for the tip Bertrand, I understand SQLResultRow better now. I will
> try that
>
> Regards,
>
>
> On Saturday, 23 July 2011, Bertrand Guay-Paquet <be...@step.polymtl.ca>
> wrote:
> > Hi,
> >
> > SQLResultRow is a type I made up. I didn't know what type you received
> from your SQL query, so I used that. I assumed that your result set is
> composed of rows where each row can be used as a "map" with key=column name
> and value=column value.
> >
> > With that in hand, you could iterate over the keys to build the list of
> datatable columns. Each column would hold its key value and would use it to
> access the proper column value from a result row.
> >
> >
> > On 23/07/2011 10:12 AM, davut uysal wrote:
> >>
> >> Hi Bertrand,
> >>
> >> What is SQLResultRow, is it a Wicket Type? Or should I create a custom
> class
> >> named "SQLResultRow"?
> >>
> >> The problem is, I can't create a custom "SQLResultRow" because I can't
> be
> >> sure of its member fields.
> >>
> >> User can run any SQL, so the type must be compatible with any result.
> For
> >> example:
> >> 1) select firstname, lastname from employees;   =>  Returns<Employee>
> >> 2) select locationcode, locationname from locations; =>
>  Returns<Location>
> >> ... (any SQL can return any unpredictable object)
> >> So it is impossible to create a custom "SQLResultRow"
> >>
> >> Anyway, I have solved the problem in the complex, hard way which is
> about
> to
> >> use 2 nested repeaters (ListView). 1 for table column names loop, 1 for
> >> table rows loop.
> >>
> >> And, I got the answer: There is no easy way in wicket to do that kind of
> >> dynamic thing.
> >>
> >> Thanks,
> >>
> >>
> >> On 22 July 2011 18:03, Bertrand Guay-Paquet<be...@step.polymtl.ca>
>  wrote:
> >>
> >>> Hi,
> >>>
> >>> Here is the outline of a possible implementation :
> >>>
> >>> Execute SQL String
> >>> Create a List<IColumn<SQLResultRow>>
> >>> for each SQL result column:
> >>>    add a column to the list that displays one column of a SQLResultRow
> >>> Create a very simple ISortableDataProvider that returns the SQL result
> from
> >>> above
> >>> (make it more complex to implement sorting)
> >>> Create a DataTable using the column list and the data provider
> >>>
> >>>
> >>> On 22/07/2011 2:05 AM, davut uysal wrote:
> >>>
> >>>> Someone in another forum advised me this:
> >>>>
> >>>> ***
> >>>> Maybe in latest Wicket something changed but in 1.4.16 you can't
> change
> >>>> Columns in DataTable. So it's immutable in some sense.
> >>>>
> >>>> But you may replace whole DataTable component instead when your sql
> >>>> statement changes:
> >>>>
> >>>> form.add(new Button("sqlSubmit") {
> >>>>    void onSubmit() {
> >>>>      String sql = ...;
> >>>>      form.replace(createDataTable("**myDataTable", sql));
> >>>>    }
> >>>> })
> >>>> form.add(createDataTable("**myDataTable", null));
> >>>>
> >>>> Where createDataTable() creates DataTable using provided id and sql
> >>>> string.
> >>>> Also there is a convenient method Component.replaceWith(). Maybe it'll
> fit
> >>>> better to your coding style.
> >>>>
> >>>> ***
> >>>>
> >>>> I think this is what I need, but I dont know how to do. Can someone
> please
> >>>> help me to create below method?
> >>>>
> >>>> *createDataTable("wicketId", "SQL")*
> >>>>
> >>>> Thanks,
> >>>>
> >>>> On 21 July 2011 21:05, Andrew Fielden<andrew.fielden@power-**
> oasis.com<
> andrew.fielden@power-oasis.com>
> >>>>>
> >>>>> wrote:
> >>>>
> >>>>  I see your problem Davut, but I really don't think Wicket can solve
> it
> in
> >>>>>
> >>>>> the
> >>>>> way you want it to. As Martin said, you need an<entity>   to populate
> the
> >>>>> models used by the various Wicket components.
> >>>>> Could you somehow parse the SQL statement to extract the table name,
> and
> >>>>> find its meta data?
> >>>>>
> >>>>>
> >>>>> --
> >>>>> View this message in context:
> >>>>> http://apache-wicket.1842946. <http://apache-wicket.1842946.>**
> n4.nabble.com/dynamic-**
> >>>>> DataTable-tp3683514p3684513.**html<
>
> http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html
> >
> >>>>> Sent from the Users forum mailing list archive at Nabble.com.
> >>>>>
> >>>>> ------------------------------**------------------------------**
> >>>>> ---------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
> users-unsubscribe@wicket.apache.org>
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>
> ------------------------------**------------------------------**---------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
> users-unsubscribe@wicket.apache.org>
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
Thanks for the tip Bertrand, I understand SQLResultRow better now. I will
try that

Regards,


On Saturday, 23 July 2011, Bertrand Guay-Paquet <be...@step.polymtl.ca>
wrote:
> Hi,
>
> SQLResultRow is a type I made up. I didn't know what type you received
from your SQL query, so I used that. I assumed that your result set is
composed of rows where each row can be used as a "map" with key=column name
and value=column value.
>
> With that in hand, you could iterate over the keys to build the list of
datatable columns. Each column would hold its key value and would use it to
access the proper column value from a result row.
>
>
> On 23/07/2011 10:12 AM, davut uysal wrote:
>>
>> Hi Bertrand,
>>
>> What is SQLResultRow, is it a Wicket Type? Or should I create a custom
class
>> named "SQLResultRow"?
>>
>> The problem is, I can't create a custom "SQLResultRow" because I can't be
>> sure of its member fields.
>>
>> User can run any SQL, so the type must be compatible with any result. For
>> example:
>> 1) select firstname, lastname from employees;   =>  Returns<Employee>
>> 2) select locationcode, locationname from locations; =>
 Returns<Location>
>> ... (any SQL can return any unpredictable object)
>> So it is impossible to create a custom "SQLResultRow"
>>
>> Anyway, I have solved the problem in the complex, hard way which is about
to
>> use 2 nested repeaters (ListView). 1 for table column names loop, 1 for
>> table rows loop.
>>
>> And, I got the answer: There is no easy way in wicket to do that kind of
>> dynamic thing.
>>
>> Thanks,
>>
>>
>> On 22 July 2011 18:03, Bertrand Guay-Paquet<be...@step.polymtl.ca>
 wrote:
>>
>>> Hi,
>>>
>>> Here is the outline of a possible implementation :
>>>
>>> Execute SQL String
>>> Create a List<IColumn<SQLResultRow>>
>>> for each SQL result column:
>>>    add a column to the list that displays one column of a SQLResultRow
>>> Create a very simple ISortableDataProvider that returns the SQL result
from
>>> above
>>> (make it more complex to implement sorting)
>>> Create a DataTable using the column list and the data provider
>>>
>>>
>>> On 22/07/2011 2:05 AM, davut uysal wrote:
>>>
>>>> Someone in another forum advised me this:
>>>>
>>>> ***
>>>> Maybe in latest Wicket something changed but in 1.4.16 you can't change
>>>> Columns in DataTable. So it's immutable in some sense.
>>>>
>>>> But you may replace whole DataTable component instead when your sql
>>>> statement changes:
>>>>
>>>> form.add(new Button("sqlSubmit") {
>>>>    void onSubmit() {
>>>>      String sql = ...;
>>>>      form.replace(createDataTable("**myDataTable", sql));
>>>>    }
>>>> })
>>>> form.add(createDataTable("**myDataTable", null));
>>>>
>>>> Where createDataTable() creates DataTable using provided id and sql
>>>> string.
>>>> Also there is a convenient method Component.replaceWith(). Maybe it'll
fit
>>>> better to your coding style.
>>>>
>>>> ***
>>>>
>>>> I think this is what I need, but I dont know how to do. Can someone
please
>>>> help me to create below method?
>>>>
>>>> *createDataTable("wicketId", "SQL")*
>>>>
>>>> Thanks,
>>>>
>>>> On 21 July 2011 21:05, Andrew Fielden<andrew.fielden@power-**oasis.com<
andrew.fielden@power-oasis.com>
>>>>>
>>>>> wrote:
>>>>
>>>>  I see your problem Davut, but I really don't think Wicket can solve it
in
>>>>>
>>>>> the
>>>>> way you want it to. As Martin said, you need an<entity>   to populate
the
>>>>> models used by the various Wicket components.
>>>>> Could you somehow parse the SQL statement to extract the table name,
and
>>>>> find its meta data?
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://apache-wicket.1842946. <http://apache-wicket.1842946.>**
n4.nabble.com/dynamic-**
>>>>> DataTable-tp3683514p3684513.**html<
http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html
>
>>>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
users-unsubscribe@wicket.apache.org>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>
------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
users-unsubscribe@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: dynamic DataTable

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Hi,

SQLResultRow is a type I made up. I didn't know what type you received 
from your SQL query, so I used that. I assumed that your result set is 
composed of rows where each row can be used as a "map" with key=column 
name and value=column value.

With that in hand, you could iterate over the keys to build the list of 
datatable columns. Each column would hold its key value and would use it 
to access the proper column value from a result row.


On 23/07/2011 10:12 AM, davut uysal wrote:
> Hi Bertrand,
>
> What is SQLResultRow, is it a Wicket Type? Or should I create a custom class
> named "SQLResultRow"?
>
> The problem is, I can't create a custom "SQLResultRow" because I can't be
> sure of its member fields.
>
> User can run any SQL, so the type must be compatible with any result. For
> example:
> 1) select firstname, lastname from employees;   =>  Returns<Employee>
> 2) select locationcode, locationname from locations; =>  Returns<Location>
> ... (any SQL can return any unpredictable object)
> So it is impossible to create a custom "SQLResultRow"
>
> Anyway, I have solved the problem in the complex, hard way which is about to
> use 2 nested repeaters (ListView). 1 for table column names loop, 1 for
> table rows loop.
>
> And, I got the answer: There is no easy way in wicket to do that kind of
> dynamic thing.
>
> Thanks,
>
>
> On 22 July 2011 18:03, Bertrand Guay-Paquet<be...@step.polymtl.ca>  wrote:
>
>> Hi,
>>
>> Here is the outline of a possible implementation :
>>
>> Execute SQL String
>> Create a List<IColumn<SQLResultRow>>
>> for each SQL result column:
>>     add a column to the list that displays one column of a SQLResultRow
>> Create a very simple ISortableDataProvider that returns the SQL result from
>> above
>> (make it more complex to implement sorting)
>> Create a DataTable using the column list and the data provider
>>
>>
>> On 22/07/2011 2:05 AM, davut uysal wrote:
>>
>>> Someone in another forum advised me this:
>>>
>>> ***
>>> Maybe in latest Wicket something changed but in 1.4.16 you can't change
>>> Columns in DataTable. So it's immutable in some sense.
>>>
>>> But you may replace whole DataTable component instead when your sql
>>> statement changes:
>>>
>>> form.add(new Button("sqlSubmit") {
>>>     void onSubmit() {
>>>       String sql = ...;
>>>       form.replace(createDataTable("**myDataTable", sql));
>>>     }
>>> })
>>> form.add(createDataTable("**myDataTable", null));
>>>
>>> Where createDataTable() creates DataTable using provided id and sql
>>> string.
>>> Also there is a convenient method Component.replaceWith(). Maybe it'll fit
>>> better to your coding style.
>>>
>>> ***
>>>
>>> I think this is what I need, but I dont know how to do. Can someone please
>>> help me to create below method?
>>>
>>> *createDataTable("wicketId", "SQL")*
>>>
>>> Thanks,
>>>
>>> On 21 July 2011 21:05, Andrew Fielden<an...@power-oasis.com>
>>>> wrote:
>>>   I see your problem Davut, but I really don't think Wicket can solve it in
>>>> the
>>>> way you want it to. As Martin said, you need an<entity>   to populate the
>>>> models used by the various Wicket components.
>>>> Could you somehow parse the SQL statement to extract the table name, and
>>>> find its meta data?
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://apache-wicket.1842946.**n4.nabble.com/dynamic-**
>>>> DataTable-tp3683514p3684513.**html<http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html>
>>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

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


Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
Hi Bertrand,

What is SQLResultRow, is it a Wicket Type? Or should I create a custom class
named "SQLResultRow"?

The problem is, I can't create a custom "SQLResultRow" because I can't be
sure of its member fields.

User can run any SQL, so the type must be compatible with any result. For
example:
1) select firstname, lastname from employees;   => Returns <Employee>
2) select locationcode, locationname from locations; => Returns <Location>
... (any SQL can return any unpredictable object)
So it is impossible to create a custom "SQLResultRow"

Anyway, I have solved the problem in the complex, hard way which is about to
use 2 nested repeaters (ListView). 1 for table column names loop, 1 for
table rows loop.

And, I got the answer: There is no easy way in wicket to do that kind of
dynamic thing.

Thanks,


On 22 July 2011 18:03, Bertrand Guay-Paquet <be...@step.polymtl.ca> wrote:

> Hi,
>
> Here is the outline of a possible implementation :
>
> Execute SQL String
> Create a List<IColumn<SQLResultRow>>
> for each SQL result column:
>    add a column to the list that displays one column of a SQLResultRow
> Create a very simple ISortableDataProvider that returns the SQL result from
> above
> (make it more complex to implement sorting)
> Create a DataTable using the column list and the data provider
>
>
> On 22/07/2011 2:05 AM, davut uysal wrote:
>
>> Someone in another forum advised me this:
>>
>> ***
>> Maybe in latest Wicket something changed but in 1.4.16 you can't change
>> Columns in DataTable. So it's immutable in some sense.
>>
>> But you may replace whole DataTable component instead when your sql
>> statement changes:
>>
>> form.add(new Button("sqlSubmit") {
>>    void onSubmit() {
>>      String sql = ...;
>>      form.replace(createDataTable("**myDataTable", sql));
>>    }
>> })
>> form.add(createDataTable("**myDataTable", null));
>>
>> Where createDataTable() creates DataTable using provided id and sql
>> string.
>> Also there is a convenient method Component.replaceWith(). Maybe it'll fit
>> better to your coding style.
>>
>> ***
>>
>> I think this is what I need, but I dont know how to do. Can someone please
>> help me to create below method?
>>
>> *createDataTable("wicketId", "SQL")*
>>
>> Thanks,
>>
>> On 21 July 2011 21:05, Andrew Fielden<an...@power-oasis.com>
>> >wrote:
>>
>>  I see your problem Davut, but I really don't think Wicket can solve it in
>>> the
>>> way you want it to. As Martin said, you need an<entity>  to populate the
>>> models used by the various Wicket components.
>>> Could you somehow parse the SQL statement to extract the table name, and
>>> find its meta data?
>>>
>>>
>>> --
>>> View this message in context:
>>> http://apache-wicket.1842946.**n4.nabble.com/dynamic-**
>>> DataTable-tp3683514p3684513.**html<http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html>
>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: dynamic DataTable

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Hi,

Here is the outline of a possible implementation :

Execute SQL String
Create a List<IColumn<SQLResultRow>>
for each SQL result column:
     add a column to the list that displays one column of a SQLResultRow
Create a very simple ISortableDataProvider that returns the SQL result 
from above
(make it more complex to implement sorting)
Create a DataTable using the column list and the data provider


On 22/07/2011 2:05 AM, davut uysal wrote:
> Someone in another forum advised me this:
>
> ***
> Maybe in latest Wicket something changed but in 1.4.16 you can't change
> Columns in DataTable. So it's immutable in some sense.
>
> But you may replace whole DataTable component instead when your sql
> statement changes:
>
> form.add(new Button("sqlSubmit") {
>     void onSubmit() {
>       String sql = ...;
>       form.replace(createDataTable("myDataTable", sql));
>     }
> })
> form.add(createDataTable("myDataTable", null));
>
> Where createDataTable() creates DataTable using provided id and sql string.
> Also there is a convenient method Component.replaceWith(). Maybe it'll fit
> better to your coding style.
>
> ***
>
> I think this is what I need, but I dont know how to do. Can someone please
> help me to create below method?
>
> *createDataTable("wicketId", "SQL")*
>
> Thanks,
>
> On 21 July 2011 21:05, Andrew Fielden<an...@power-oasis.com>wrote:
>
>> I see your problem Davut, but I really don't think Wicket can solve it in
>> the
>> way you want it to. As Martin said, you need an<entity>  to populate the
>> models used by the various Wicket components.
>> Could you somehow parse the SQL statement to extract the table name, and
>> find its meta data?
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

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


Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
Someone in another forum advised me this:

***
Maybe in latest Wicket something changed but in 1.4.16 you can't change
Columns in DataTable. So it's immutable in some sense.

But you may replace whole DataTable component instead when your sql
statement changes:

form.add(new Button("sqlSubmit") {
   void onSubmit() {
     String sql = ...;
     form.replace(createDataTable("myDataTable", sql));
   }
})
form.add(createDataTable("myDataTable", null));

Where createDataTable() creates DataTable using provided id and sql string.
Also there is a convenient method Component.replaceWith(). Maybe it'll fit
better to your coding style.

***

I think this is what I need, but I dont know how to do. Can someone please
help me to create below method?

*createDataTable("wicketId", "SQL")*

Thanks,

On 21 July 2011 21:05, Andrew Fielden <an...@power-oasis.com>wrote:

> I see your problem Davut, but I really don't think Wicket can solve it in
> the
> way you want it to. As Martin said, you need an <entity> to populate the
> models used by the various Wicket components.
> Could you somehow parse the SQL statement to extract the table name, and
> find its meta data?
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: dynamic DataTable

Posted by Andrew Fielden <an...@power-oasis.com>.
I see your problem Davut, but I really don't think Wicket can solve it in the
way you want it to. As Martin said, you need an <entity> to populate the
models used by the various Wicket components.
Could you somehow parse the SQL statement to extract the table name, and
find its meta data?


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3684513.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
Yes Andrew, until I find a real simple solution :)

I am currently migrating a Struts project to Wicket. And this is the only
issue I have. I hate doing things in a long way, there must be a simple
solution.

Btw: nice to see you here too after stackoverflow and linkedin :)
On Jul 21, 2011 6:05 PM, "Andrew Fielden" <an...@power-oasis.com>
wrote:
> Hi again Davut :)
>
> Are you asking this question in every possible forum in the hope of
getting
> a different answer?
>
>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3683930.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

Re: dynamic DataTable

Posted by Andrew Fielden <an...@power-oasis.com>.
Hi again Davut :)

Are you asking this question in every possible forum in the hope of getting
a different answer?


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/dynamic-DataTable-tp3683514p3683930.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
OK. I am glad someone is trying to understand my problem :)

So, what is complex about Wicket and Datatable to show any SQL results in a
HTML table format. (Just as you may know Oracle 's iSQL-Plus which you just
write SQL, then click on Run command and then see the results in a HTML
table)

1) For simple way, you need domain objects as you call <Entity>. But for an
unknown SQL command this is impossible because you cant know what domain
object the SQL result will match, right

2) For the custom way, you need to code nested repeaters for the case you
dont use any domain objects, to loop for table headers and rows.

Just tell me there is no way other than option 2 which is the hard way..

BTW: Struts is just a View layer too, but it has DisplayTag component that
saves you from coding nested repeaters, loopers etc.


On 21 July 2011 17:22, Martin Grigorov <mg...@apache.org> wrote:

> Am I that old or .NET is younger than 10 years ?
>
> First tell me what is so complex with wicket-extensions DataTable and
> I'll tell you how to do it ;-)
>
> You *need* to extract the DB meta data if you want the dynamics.
> Wicket is web framework, not common data extraction framework.
> Once you have the column names then you can create the
> List<IColumn<Entity>> and IDataProvider<Entity> needed by DataTable.
> From there on Wicket will create the table for you.
>
> So if you do the "easy" part to extract the columns meta data then
> give it to me and I'll do the "hard" part to dress it in a DataTable
> ;-)
>
> On Thu, Jul 21, 2011 at 5:08 PM, davut uysal <da...@gmail.com> wrote:
> > Yeah, I agree there must be some easier way. I hope the Wicket gurus and
> > fanboys here can show the simple way and save the Wicket's title and
> pride -
> > easiest framework ever :)
> >
> > I remember, even the Struts 1 framework had a component named
> "DisplayTag"
> > that can be easily bind to dynamic datasets or resultsets. So Struts 1
> > DisplayTag component can show any data in a Table format without needing
> to
> > know the result of the SELECT SQL Queries. It can show the results of any
> > SQL simply without coding any nested repeater to loop for headers and
> rows..
> >
> > I also remember, even 10 years ago it was very easy to do this kind of
> > dynamic things in .NET. .NET has GridView component which can also be
> bind
> > easily to any dataset simply, just simple as below:
> >
> >            DataSet ds = new DataSet();
> >            OracleConnection conn = new
> > OracleConnection(strConnectionString);
> >            OracleDataAdapter adap = new OracleDataAdapter(txtSql.Text,
> > conn);
> >
> >            conn.Open();
> >            adap.Fill(ds);
> >
> >            GridView1.DataSource = ds;
> >            GridView1.DataBind();
> >
> > So tell me if Wicket framework is that simple or not :)
> >
> >
> > On 21 July 2011 15:18, Lurtz Nazgul <lu...@ymail.com> wrote:
> >
> >> Any simple way ?
> >>
> >> Thanks.
> >>
> >>
> >>
> >> ________________________________
> >> From: Wilhelmsen Tor Iver <To...@arrive.no>
> >> To: "users@wicket.apache.org" <us...@wicket.apache.org>
> >> Sent: Thu, July 21, 2011 3:10:16 PM
> >> Subject: RE: dynamic DataTable
> >>
> >> > Since TextArea can contain any SELECT statement, Column names, count
> can
> >> >change
> >> >
> >> > every time. So I need a dynamic table that is compatible to view  any
> >> SELECT
> >> > Statement result.
> >>
> >> Since you appear to have no need for performing updates or inserts, try
> >> ditching
> >> the DataTable in favour of using nested repeaters over the
> >> ResultSetMetaData
> >> column info and ResultSet rows instead.
> >>
> >> - Tor Iver
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: dynamic DataTable

Posted by Martin Grigorov <mg...@apache.org>.
Am I that old or .NET is younger than 10 years ?

First tell me what is so complex with wicket-extensions DataTable and
I'll tell you how to do it ;-)

You *need* to extract the DB meta data if you want the dynamics.
Wicket is web framework, not common data extraction framework.
Once you have the column names then you can create the
List<IColumn<Entity>> and IDataProvider<Entity> needed by DataTable.
>From there on Wicket will create the table for you.

So if you do the "easy" part to extract the columns meta data then
give it to me and I'll do the "hard" part to dress it in a DataTable
;-)

On Thu, Jul 21, 2011 at 5:08 PM, davut uysal <da...@gmail.com> wrote:
> Yeah, I agree there must be some easier way. I hope the Wicket gurus and
> fanboys here can show the simple way and save the Wicket's title and pride -
> easiest framework ever :)
>
> I remember, even the Struts 1 framework had a component named "DisplayTag"
> that can be easily bind to dynamic datasets or resultsets. So Struts 1
> DisplayTag component can show any data in a Table format without needing to
> know the result of the SELECT SQL Queries. It can show the results of any
> SQL simply without coding any nested repeater to loop for headers and rows..
>
> I also remember, even 10 years ago it was very easy to do this kind of
> dynamic things in .NET. .NET has GridView component which can also be bind
> easily to any dataset simply, just simple as below:
>
>            DataSet ds = new DataSet();
>            OracleConnection conn = new
> OracleConnection(strConnectionString);
>            OracleDataAdapter adap = new OracleDataAdapter(txtSql.Text,
> conn);
>
>            conn.Open();
>            adap.Fill(ds);
>
>            GridView1.DataSource = ds;
>            GridView1.DataBind();
>
> So tell me if Wicket framework is that simple or not :)
>
>
> On 21 July 2011 15:18, Lurtz Nazgul <lu...@ymail.com> wrote:
>
>> Any simple way ?
>>
>> Thanks.
>>
>>
>>
>> ________________________________
>> From: Wilhelmsen Tor Iver <To...@arrive.no>
>> To: "users@wicket.apache.org" <us...@wicket.apache.org>
>> Sent: Thu, July 21, 2011 3:10:16 PM
>> Subject: RE: dynamic DataTable
>>
>> > Since TextArea can contain any SELECT statement, Column names, count can
>> >change
>> >
>> > every time. So I need a dynamic table that is compatible to view  any
>> SELECT
>> > Statement result.
>>
>> Since you appear to have no need for performing updates or inserts, try
>> ditching
>> the DataTable in favour of using nested repeaters over the
>> ResultSetMetaData
>> column info and ResultSet rows instead.
>>
>> - Tor Iver
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: dynamic DataTable

Posted by davut uysal <da...@gmail.com>.
Yeah, I agree there must be some easier way. I hope the Wicket gurus and
fanboys here can show the simple way and save the Wicket's title and pride -
easiest framework ever :)

I remember, even the Struts 1 framework had a component named "DisplayTag"
that can be easily bind to dynamic datasets or resultsets. So Struts 1
DisplayTag component can show any data in a Table format without needing to
know the result of the SELECT SQL Queries. It can show the results of any
SQL simply without coding any nested repeater to loop for headers and rows..

I also remember, even 10 years ago it was very easy to do this kind of
dynamic things in .NET. .NET has GridView component which can also be bind
easily to any dataset simply, just simple as below:

            DataSet ds = new DataSet();
            OracleConnection conn = new
OracleConnection(strConnectionString);
            OracleDataAdapter adap = new OracleDataAdapter(txtSql.Text,
conn);

            conn.Open();
            adap.Fill(ds);

            GridView1.DataSource = ds;
            GridView1.DataBind();

So tell me if Wicket framework is that simple or not :)


On 21 July 2011 15:18, Lurtz Nazgul <lu...@ymail.com> wrote:

> Any simple way ?
>
> Thanks.
>
>
>
> ________________________________
> From: Wilhelmsen Tor Iver <To...@arrive.no>
> To: "users@wicket.apache.org" <us...@wicket.apache.org>
> Sent: Thu, July 21, 2011 3:10:16 PM
> Subject: RE: dynamic DataTable
>
> > Since TextArea can contain any SELECT statement, Column names, count can
> >change
> >
> > every time. So I need a dynamic table that is compatible to view  any
> SELECT
> > Statement result.
>
> Since you appear to have no need for performing updates or inserts, try
> ditching
> the DataTable in favour of using nested repeaters over the
> ResultSetMetaData
> column info and ResultSet rows instead.
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org

Re: dynamic DataTable

Posted by Lurtz Nazgul <lu...@ymail.com>.
Any simple way ? 

Thanks.



________________________________
From: Wilhelmsen Tor Iver <To...@arrive.no>
To: "users@wicket.apache.org" <us...@wicket.apache.org>
Sent: Thu, July 21, 2011 3:10:16 PM
Subject: RE: dynamic DataTable

> Since TextArea can contain any SELECT statement, Column names, count can  
>change 
>
> every time. So I need a dynamic table that is compatible to view  any SELECT 
> Statement result.

Since you appear to have no need for performing updates or inserts, try ditching 
the DataTable in favour of using nested repeaters over the ResultSetMetaData 
column info and ResultSet rows instead.

- Tor Iver

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

RE: dynamic DataTable

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Since TextArea can contain any SELECT statement, Column names, count can  change 
> every time. So I need a dynamic table that is compatible to view  any SELECT 
> Statement result.

Since you appear to have no need for performing updates or inserts, try ditching the DataTable in favour of using nested repeaters over the ResultSetMetaData column info and ResultSet rows instead.

- Tor Iver

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