You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matt Schmidt <ms...@gmail.com> on 2011/07/29 23:01:40 UTC

Manually Rendering a DataGridView

Is there any way to access the HTML of each cell that would be rendered in a
DataGridView without adding it to the page and actually rendering it?

Ultimately, I am trying to add all of the inner HTML of the cells of the
DataGridView to a JavaScript array.

Re: Manually Rendering a DataGridView

Posted by Matt Schmidt <ms...@gmail.com>.
I already have a WiQuery plugin/behavior that does basically the same thing.
It renders the table's HTML to the page, then jQuery has to parse through it
and put it in the DOM to initialize. It gets awfully slow with a lot of
data. That's why I'm trying to not render the table to the HTML at all, and
initialize with a JavaScript array that puts the data directly in the DOM.

On Mon, Aug 1, 2011 at 10:38 AM, Martin Grigorov <mg...@apache.org>wrote:

> See
> https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/datatables-parent
>
> On Mon, Aug 1, 2011 at 3:54 PM, Matt Schmidt <ms...@gmail.com> wrote:
> > Gotcha. Is there a way to do this without adding the DGV to the page? In
> my
> > case, I just want to add an empty <table/> tag and pass the "would-be"
> > rendered HTML of the DGV to a jQuery function that populates the table.
> >
> > Specifically, I am trying to dynamically instantiate a jQuery DataTables
> > using the "JavaScript array" method (
> > http://datatables.net/examples/data_sources/js_array.html).
> >
> > On Sun, Jul 31, 2011 at 10:40 PM, Pedro Santos <pe...@gmail.com>
> wrote:
> >
> >> The char sequence is returned by mockResponse.getText()
> >> Sure, there are no public methods and would be a good idea to
> >> refectory the code and move the mock response logic to other place.
> >> You can use an IVisitor to visit cells in you component tree,  create
> >> a mock response to render them and use its text, i.e.
> >> mockResponse.getText(), to fit your needs
> >>
> >> On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt <ms...@gmail.com>
> >> wrote:
> >> > So after calling tableParser.parse(myDataGridView), how do I get the
> the
> >> > char sequence? Or iterate over each row to get the char sequence for
> each
> >> > cell? I don't see any public methods for that.
> >> >
> >> > On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
> >> >> Hi, I had a similar need and used the code at TableParser[1] to
> render
> >> >> the component tree to a mock response and later get its char
> sequence.
> >> >>
> >> >> 1 -
> >> >
> >>
> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
> >> >>
> >> >> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
> >> > wrote:
> >> >>> Is there any way to access the HTML of each cell that would be
> rendered
> >> > in a
> >> >>> DataGridView without adding it to the page and actually rendering
> it?
> >> >>>
> >> >>> Ultimately, I am trying to add all of the inner HTML of the cells of
> >> the
> >> >>> DataGridView to a JavaScript array.
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Pedro Henrique Oliveira dos Santos
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Pedro Henrique Oliveira dos Santos
> >>
> >> ---------------------------------------------------------------------
> >> 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: Manually Rendering a DataGridView

Posted by Martin Grigorov <mg...@apache.org>.
See https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/datatables-parent

On Mon, Aug 1, 2011 at 3:54 PM, Matt Schmidt <ms...@gmail.com> wrote:
> Gotcha. Is there a way to do this without adding the DGV to the page? In my
> case, I just want to add an empty <table/> tag and pass the "would-be"
> rendered HTML of the DGV to a jQuery function that populates the table.
>
> Specifically, I am trying to dynamically instantiate a jQuery DataTables
> using the "JavaScript array" method (
> http://datatables.net/examples/data_sources/js_array.html).
>
> On Sun, Jul 31, 2011 at 10:40 PM, Pedro Santos <pe...@gmail.com> wrote:
>
>> The char sequence is returned by mockResponse.getText()
>> Sure, there are no public methods and would be a good idea to
>> refectory the code and move the mock response logic to other place.
>> You can use an IVisitor to visit cells in you component tree,  create
>> a mock response to render them and use its text, i.e.
>> mockResponse.getText(), to fit your needs
>>
>> On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt <ms...@gmail.com>
>> wrote:
>> > So after calling tableParser.parse(myDataGridView), how do I get the the
>> > char sequence? Or iterate over each row to get the char sequence for each
>> > cell? I don't see any public methods for that.
>> >
>> > On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
>> >> Hi, I had a similar need and used the code at TableParser[1] to render
>> >> the component tree to a mock response and later get its char sequence.
>> >>
>> >> 1 -
>> >
>> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>> >>
>> >> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
>> > wrote:
>> >>> Is there any way to access the HTML of each cell that would be rendered
>> > in a
>> >>> DataGridView without adding it to the page and actually rendering it?
>> >>>
>> >>> Ultimately, I am trying to add all of the inner HTML of the cells of
>> the
>> >>> DataGridView to a JavaScript array.
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Pedro Henrique Oliveira dos Santos
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>> ---------------------------------------------------------------------
>> 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: Manually Rendering a DataGridView

Posted by Pedro Santos <pe...@gmail.com>.
I don't think you can because page carries some renderer state. What
do you think about use a transient page? one with just one component
slot available to you plug any component you want, visit children,
extract the info you need to assemble the JavaScript, and discard its
instance to be garbage collected latter.

On Mon, Aug 1, 2011 at 9:54 AM, Matt Schmidt <ms...@gmail.com> wrote:
> Gotcha. Is there a way to do this without adding the DGV to the page? In my
> case, I just want to add an empty <table/> tag and pass the "would-be"
> rendered HTML of the DGV to a jQuery function that populates the table.
>
> Specifically, I am trying to dynamically instantiate a jQuery DataTables
> using the "JavaScript array" method (
> http://datatables.net/examples/data_sources/js_array.html).
>
> On Sun, Jul 31, 2011 at 10:40 PM, Pedro Santos <pe...@gmail.com> wrote:
>
>> The char sequence is returned by mockResponse.getText()
>> Sure, there are no public methods and would be a good idea to
>> refectory the code and move the mock response logic to other place.
>> You can use an IVisitor to visit cells in you component tree,  create
>> a mock response to render them and use its text, i.e.
>> mockResponse.getText(), to fit your needs
>>
>> On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt <ms...@gmail.com>
>> wrote:
>> > So after calling tableParser.parse(myDataGridView), how do I get the the
>> > char sequence? Or iterate over each row to get the char sequence for each
>> > cell? I don't see any public methods for that.
>> >
>> > On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
>> >> Hi, I had a similar need and used the code at TableParser[1] to render
>> >> the component tree to a mock response and later get its char sequence.
>> >>
>> >> 1 -
>> >
>> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>> >>
>> >> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
>> > wrote:
>> >>> Is there any way to access the HTML of each cell that would be rendered
>> > in a
>> >>> DataGridView without adding it to the page and actually rendering it?
>> >>>
>> >>> Ultimately, I am trying to add all of the inner HTML of the cells of
>> the
>> >>> DataGridView to a JavaScript array.
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Pedro Henrique Oliveira dos Santos
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Pedro Henrique Oliveira dos Santos

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


Re: Manually Rendering a DataGridView

Posted by Matt Schmidt <ms...@gmail.com>.
Gotcha. Is there a way to do this without adding the DGV to the page? In my
case, I just want to add an empty <table/> tag and pass the "would-be"
rendered HTML of the DGV to a jQuery function that populates the table.

Specifically, I am trying to dynamically instantiate a jQuery DataTables
using the "JavaScript array" method (
http://datatables.net/examples/data_sources/js_array.html).

On Sun, Jul 31, 2011 at 10:40 PM, Pedro Santos <pe...@gmail.com> wrote:

> The char sequence is returned by mockResponse.getText()
> Sure, there are no public methods and would be a good idea to
> refectory the code and move the mock response logic to other place.
> You can use an IVisitor to visit cells in you component tree,  create
> a mock response to render them and use its text, i.e.
> mockResponse.getText(), to fit your needs
>
> On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt <ms...@gmail.com>
> wrote:
> > So after calling tableParser.parse(myDataGridView), how do I get the the
> > char sequence? Or iterate over each row to get the char sequence for each
> > cell? I don't see any public methods for that.
> >
> > On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
> >> Hi, I had a similar need and used the code at TableParser[1] to render
> >> the component tree to a mock response and later get its char sequence.
> >>
> >> 1 -
> >
> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
> >>
> >> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
> > wrote:
> >>> Is there any way to access the HTML of each cell that would be rendered
> > in a
> >>> DataGridView without adding it to the page and actually rendering it?
> >>>
> >>> Ultimately, I am trying to add all of the inner HTML of the cells of
> the
> >>> DataGridView to a JavaScript array.
> >>>
> >>
> >>
> >>
> >> --
> >> Pedro Henrique Oliveira dos Santos
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Manually Rendering a DataGridView

Posted by Pedro Santos <pe...@gmail.com>.
The char sequence is returned by mockResponse.getText()
Sure, there are no public methods and would be a good idea to
refectory the code and move the mock response logic to other place.
You can use an IVisitor to visit cells in you component tree,  create
a mock response to render them and use its text, i.e.
mockResponse.getText(), to fit your needs

On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt <ms...@gmail.com> wrote:
> So after calling tableParser.parse(myDataGridView), how do I get the the
> char sequence? Or iterate over each row to get the char sequence for each
> cell? I don't see any public methods for that.
>
> On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
>> Hi, I had a similar need and used the code at TableParser[1] to render
>> the component tree to a mock response and later get its char sequence.
>>
>> 1 -
> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>>
>> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
> wrote:
>>> Is there any way to access the HTML of each cell that would be rendered
> in a
>>> DataGridView without adding it to the page and actually rendering it?
>>>
>>> Ultimately, I am trying to add all of the inner HTML of the cells of the
>>> DataGridView to a JavaScript array.
>>>
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Pedro Henrique Oliveira dos Santos

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


Re: Manually Rendering a DataGridView

Posted by Matt Schmidt <ms...@gmail.com>.
So after calling tableParser.parse(myDataGridView), how do I get the the
char sequence? Or iterate over each row to get the char sequence for each
cell? I don't see any public methods for that.

On Sunday, July 31, 2011, Pedro Santos <pe...@gmail.com> wrote:
> Hi, I had a similar need and used the code at TableParser[1] to render
> the component tree to a mock response and later get its char sequence.
>
> 1 -
https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>
> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com>
wrote:
>> Is there any way to access the HTML of each cell that would be rendered
in a
>> DataGridView without adding it to the page and actually rendering it?
>>
>> Ultimately, I am trying to add all of the inner HTML of the cells of the
>> DataGridView to a JavaScript array.
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Manually Rendering a DataGridView

Posted by Pedro Santos <pe...@gmail.com>.
Hi, I had a similar need and used the code at TableParser[1] to render
the component tree to a mock response and later get its char sequence.

1 - https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java

On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt <ms...@gmail.com> wrote:
> Is there any way to access the HTML of each cell that would be rendered in a
> DataGridView without adding it to the page and actually rendering it?
>
> Ultimately, I am trying to add all of the inner HTML of the cells of the
> DataGridView to a JavaScript array.
>



-- 
Pedro Henrique Oliveira dos Santos

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