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.fiel...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



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

Reply via email to