Hi, Thanks for help but the problem with your solution is that it doesnt work in IE (when I have multiple columns with such links only links in first column 'fills' entire cells) in Firefox that works.
Jeremy Thomerson-5 wrote: > > If that's your problem, I'd suggest using CSS, something like: > > TD A { > display: block; > } > > This is much better because the anchor will fill the box (fixing your > problem), and you are more compatible (if JS is off, etc). > > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > On Tue, Oct 28, 2008 at 2:42 PM, dlipski <[EMAIL PROTECTED]> > wrote: > >> >> Exaclty, problem is with 'consuming' td element by Item object. >> >> The problem is that if you have wide column but short text in it some >> users >> have problem with hitting the text (which is a link) .The idea is to make >> whole td element 'clickable'(or linkable). >> The solution would be if table could have any component as row or cell >> element not only Item object. >> But I know that this is a big change in DataTable class (or one of its >> child >> component class) . >> >> >> >> jwcarman wrote: >> > >> > On Tue, Oct 28, 2008 at 3:05 PM, dlipski <[EMAIL PROTECTED]> >> > wrote: >> >> >> >> All this solutions are correct but the problem is not in attaching >> some >> >> custom Javascript to <td> element (which can be done in multiple ways) >> >> but >> >> in making td element work as a link. >> >> >> > >> > Right, the <td> element is already consumed by the Item object, so you >> > can't attach your link to it. >> > >> >> What exactly should I do to achive this ? What components should I add >> at >> >> server side at what JavaScript should I render at markup ? >> >> If I have to copy-paste bunch of Link class code it looks like some >> >> design/implementation problem of DataTable (or one of components it >> has). >> >> >> > >> > What is your requirement exactly? Is there going to be any text (or >> > image) in your cell? If so, why can't it be a link? >> > >> >> Its really supprising that such common issue is such problematic. >> >> I hope there is some simple and intuitive solution(if I find one I'll >> >> post >> >> it here) >> >> >> >> Thanks for your help >> >> Regards Daniel >> >> >> >> >> >> Michael O'Cleirigh wrote: >> >>> >> >>> Hi Daniel, >> >>> >> >>> If you subclass DefaultDataTable there is a protected method call >> >>> newCellItem(...) that you can use to attach the onclick class onto >> the >> >>> <td>. >> >>> >> >>> like: >> >>> >> >>> class MyDataTable extends DefaultDataTable { >> >>> /* (non-Javadoc) >> >>> * @see >> >>> >> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String, >> >>> int, org.apache.wicket.model.IModel) >> >>> */ >> >>> @Override >> >>> protected Item newCellItem(String id, int index, IModel model) { >> >>> >> >>> >> >>> Item cell = super.newCellItem(id, index, model); >> >>> >> >>> >> >>> cell.add(new AttributeAppender("onclick", new Model >> >>> ("someJavascriptCall();")); >> >>> >> >>> return cell; >> >>> } >> >>> } >> >>> >> >>> Alternately you can use a custom column implementation like the >> >>> FragrementColumn and add the onclick when the cell is created like: >> >>> >> >>> class MyOnClickColumn extends AbstractColumn { >> >>> ... >> >>> public void populateItem(Item cellItem, String componentId, IModel >> >>> rowModel) >> >>> { >> >>> Label cell = new Label(componentId, new >> PropertyModel(rowModel, >> >>> property)) >> >>> >> >>> cell.add (new AttributeAppender("onclick", new Model >> >>> ("someJavascriptCall();")); >> >>> >> >>> cellItem.add(cell); >> >>> } >> >>> } >> >>> >> >>> >> >>> I think the second version would attach the onclick to the label >> within >> >>> the <td></td> of a cell. >> >>> >> >>> Regards, >> >>> >> >>> Mike >> >>>> I dont know wicketopia project (and any of its classes like >> >>>> FragmentColumn) >> >>>> so I can misunderstand your idea but as far as I am able to read >> that >> >>>> code >> >>>> It looks like you are adding a link to the table cell, not making a >> >>>> cell >> >>>> itself a link. >> >>>> >> >>>> If I understand your code it is familar to: >> >>>> >> >>>> <td><a>text</a></td> >> >>>> >> >>>> but Im wondering how to achive: >> >>>> <td on click="xyz">text</td> >> >>>> >> >>>> where xyz is code generated by Wicket (like in Link component class) >> >>>> >> >>>> If I misundestood you could you give me some more details hot to >> make >> >>>> cell >> >>>> itself a link ? (not adding a link to the cell) ? >> >>>> >> >>>> Regards >> >>>> Daniel >> >>>> >> >>>> >> >>>> >> >>>> jwcarman wrote: >> >>>> >> >>>>> Here's an example where I put a remove link in a DefaultDataTable >> >>>>> cell: >> >>>>> >> >>>>> >> https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/example/src/main/java/org/wicketopia/example/web/page/HomePage.java >> >>>>> >> >>>>> >> >>>>> On Tue, Oct 28, 2008 at 6:33 AM, dlipski >> <[EMAIL PROTECTED] >> > >> >>>>> wrote: >> >>>>> >> >>>>>> Hi >> >>>>>> >> >>>>>> I have one short question: >> >>>>>> How to make entire cell in a DataTable a link ? >> >>>>>> I've read that Link component can be attached not only to >> <a> >> >>>>>> tags >> >>>>>> but >> >>>>>> also to any other html elements (like <tr> and <td>) but I dont >> know >> >>>>>> how >> >>>>>> to >> >>>>>> use it with DataTable API. >> >>>>>> >> >>>>>> Regards Daniel >> >>>>>> -- >> >>>>>> View this message in context: >> >>>>>> http://www.nabble.com/DataTable-cell-link-tp20204702p20204702.html >> >>>>>> Sent from the Wicket - User mailing list archive at Nabble.com. >> >>>>>> >> >>>>>> >> >>>>>> >> --------------------------------------------------------------------- >> >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>> >> --------------------------------------------------------------------- >> >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>>>> >> >>>>> >> >>>>> >> >>>>> >> >>>> >> >>>> >> >>> >> >>> >> >>> --------------------------------------------------------------------- >> >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>> >> >>> >> >>> >> >> >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/DataTable-cell-link-tp20204702p20213839.html >> >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/DataTable-cell-link-tp20204702p20214540.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/DataTable-cell-link-tp20204702p20222321.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]