You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Linda van der Pal <lv...@heritageagenturen.nl> on 2009/08/20 14:21:17 UTC

Truncating DataTable content

I thought it would be a cool idea to truncate the data in my table, so 
the data isn't spread over several lines in the table row. It should 
then be possible to read the complete content in a tooltip. After 
digging into the code of the AjaxFallbackDefaultDataTable I found that 
to do this I would have to alter/copy the entire structure, as it seemed 
the code I need to alter is inside AbstractDataGridView.

This seems like an aweful lot of work for such a relatively small 
feature. So my question is, has anybody ever tried this before? And even 
if not, do you have a better idea how to tackle this?

So I want the content of a single field to go from this:

Struts: the
complete
reference

to

Struts: the... (with a tooltip listing the whole title)


Regards,
Linda

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


Re: Truncating DataTable content

Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
Just in case anybody is interested in the solution.

I've extended ChoiceFilteredPropertyColumn (as that was the type of 
column I was using for my AjaxFallbackDefaultDataTable) and have 
overridden populateItem (which was originally implemented in 
PropertyColumn). In that method I both truncate the table data and add 
the PrototipBehavior that shows the tooltip.

Regards,
Linda

Iain Reddick wrote:
> Like this (for a basic html tooltip):
>
> cellItem.add( new SimpleAttributeModifier("title", maximalStringModel) );
>
> Or use one of the js-library wrappers from Wicket Stuff for something 
> slicker?
>
> Linda van der Pal wrote:
>> Thanks for the ideas, but the truncating itself is not the main 
>> problem. (I could easily truncate the data in the 
>> SortableDataProvider.) The main problem that requires met to dive 
>> deeply into the code is my requirement to also show the full data in 
>> a tooltip.
>>
>> Regards,
>> Linda
>>
>> Iain Reddick wrote:
>>> Create some kind of generic StringTruncatingModel that does the 
>>> "..." truncation on getObject().
>>>
>>> In DataTable.populateItem(), wrap the row model in a 
>>> StringTruncatingModel, before passing to the Label being used to 
>>> show the string?
>>>
>>> Linda van der Pal wrote:
>>>> I thought it would be a cool idea to truncate the data in my table, 
>>>> so the data isn't spread over several lines in the table row. It 
>>>> should then be possible to read the complete content in a tooltip. 
>>>> After digging into the code of the AjaxFallbackDefaultDataTable I 
>>>> found that to do this I would have to alter/copy the entire 
>>>> structure, as it seemed the code I need to alter is inside 
>>>> AbstractDataGridView.
>>>>
>>>> This seems like an aweful lot of work for such a relatively small 
>>>> feature. So my question is, has anybody ever tried this before? And 
>>>> even if not, do you have a better idea how to tackle this?
>>>>
>>>> So I want the content of a single field to go from this:
>>>>
>>>> Struts: the
>>>> complete
>>>> reference
>>>>
>>>> to
>>>>
>>>> Struts: the... (with a tooltip listing the whole title)
>>>>
>>>>
>>>> Regards,
>>>> Linda
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 
>>> 270.13.65/2322 - Release Date: 08/23/09 18:03:00
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> 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
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.409 / Virus Database: 270.13.65/2323 - Release Date: 08/24/09 06:05:00
>
>   


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


Re: Truncating DataTable content

Posted by Iain Reddick <ia...@beatsystems.com>.
Like this (for a basic html tooltip):

cellItem.add( new SimpleAttributeModifier("title", maximalStringModel) );

Or use one of the js-library wrappers from Wicket Stuff for something 
slicker?

Linda van der Pal wrote:
> Thanks for the ideas, but the truncating itself is not the main 
> problem. (I could easily truncate the data in the 
> SortableDataProvider.) The main problem that requires met to dive 
> deeply into the code is my requirement to also show the full data in a 
> tooltip.
>
> Regards,
> Linda
>
> Iain Reddick wrote:
>> Create some kind of generic StringTruncatingModel that does the "..." 
>> truncation on getObject().
>>
>> In DataTable.populateItem(), wrap the row model in a 
>> StringTruncatingModel, before passing to the Label being used to show 
>> the string?
>>
>> Linda van der Pal wrote:
>>> I thought it would be a cool idea to truncate the data in my table, 
>>> so the data isn't spread over several lines in the table row. It 
>>> should then be possible to read the complete content in a tooltip. 
>>> After digging into the code of the AjaxFallbackDefaultDataTable I 
>>> found that to do this I would have to alter/copy the entire 
>>> structure, as it seemed the code I need to alter is inside 
>>> AbstractDataGridView.
>>>
>>> This seems like an aweful lot of work for such a relatively small 
>>> feature. So my question is, has anybody ever tried this before? And 
>>> even if not, do you have a better idea how to tackle this?
>>>
>>> So I want the content of a single field to go from this:
>>>
>>> Struts: the
>>> complete
>>> reference
>>>
>>> to
>>>
>>> Struts: the... (with a tooltip listing the whole title)
>>>
>>>
>>> Regards,
>>> Linda
>>>
>>> ---------------------------------------------------------------------
>>> 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
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 
>> 270.13.65/2322 - Release Date: 08/23/09 18:03:00
>>
>>   
>
>
> ---------------------------------------------------------------------
> 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: Truncating DataTable content

Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
Thanks for the ideas, but the truncating itself is not the main problem. 
(I could easily truncate the data in the SortableDataProvider.) The main 
problem that requires met to dive deeply into the code is my requirement 
to also show the full data in a tooltip.

Regards,
Linda

Iain Reddick wrote:
> Create some kind of generic StringTruncatingModel that does the "..." 
> truncation on getObject().
>
> In DataTable.populateItem(), wrap the row model in a 
> StringTruncatingModel, before passing to the Label being used to show 
> the string?
>
> Linda van der Pal wrote:
>> I thought it would be a cool idea to truncate the data in my table, 
>> so the data isn't spread over several lines in the table row. It 
>> should then be possible to read the complete content in a tooltip. 
>> After digging into the code of the AjaxFallbackDefaultDataTable I 
>> found that to do this I would have to alter/copy the entire 
>> structure, as it seemed the code I need to alter is inside 
>> AbstractDataGridView.
>>
>> This seems like an aweful lot of work for such a relatively small 
>> feature. So my question is, has anybody ever tried this before? And 
>> even if not, do you have a better idea how to tackle this?
>>
>> So I want the content of a single field to go from this:
>>
>> Struts: the
>> complete
>> reference
>>
>> to
>>
>> Struts: the... (with a tooltip listing the whole title)
>>
>>
>> Regards,
>> Linda
>>
>> ---------------------------------------------------------------------
>> 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
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.409 / Virus Database: 270.13.65/2322 - Release Date: 08/23/09 18:03:00
>
>   


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


Re: Truncating DataTable content

Posted by Iain Reddick <ia...@beatsystems.com>.
Create some kind of generic StringTruncatingModel that does the "..." 
truncation on getObject().

In DataTable.populateItem(), wrap the row model in a 
StringTruncatingModel, before passing to the Label being used to show 
the string?

Linda van der Pal wrote:
> I thought it would be a cool idea to truncate the data in my table, so 
> the data isn't spread over several lines in the table row. It should 
> then be possible to read the complete content in a tooltip. After 
> digging into the code of the AjaxFallbackDefaultDataTable I found that 
> to do this I would have to alter/copy the entire structure, as it 
> seemed the code I need to alter is inside AbstractDataGridView.
>
> This seems like an aweful lot of work for such a relatively small 
> feature. So my question is, has anybody ever tried this before? And 
> even if not, do you have a better idea how to tackle this?
>
> So I want the content of a single field to go from this:
>
> Struts: the
> complete
> reference
>
> to
>
> Struts: the... (with a tooltip listing the whole title)
>
>
> Regards,
> Linda
>
> ---------------------------------------------------------------------
> 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