Andrew Klochkov wrote:
> Matej Knopp wrote:
>   
>> Second question, I assume you want to show inserted rows without
>> refreshing the entire listview? Well, this is possible to certain
>> degree, but requres some javacsript foo. You need to create the DOM
>> element with appropriate id (in javascript) before adding the newly
>> created ListItem to ajaxrequesttarget. TreeTable does it, however, not
>> with ListView. It uses different kind of repeater.
>>   
>>     
> Now I think it's impossible to insert rows in a list created with
> ListView via AJAX because children items id's are just their index in
> the list. So when I insert something in the list, I have to change id's
> of all lower items and do the same thing with scripts on the client
> side. It's getting too complex and slow.
>
> So I'm trying to create CustomListView by copying it from ListView and
> extracting children item id generation strategy. But I have a problem -
> when I create new list item during ajax request, add it to a
> CustomListView instance and append to AjaxRequestTarget, I get the
> following error:
>
> ERROR - RequestCycle               - Unable to find the markup for the
> component. That may be due to transparent containers or components
> implementing IComponentResolver: [MarkupContainer [Component id = ad4,
> page = listview.ListViewPage, path =
> 7:list-container:list:ad4.CustomListItem, isVisible = true, isVersioned
> = false]]
> wicket.WicketRuntimeException: Unable to find the markup for the
> component. That may be due to transparent containers or components
> implementing IComponentResolver: [MarkupContainer [Component id = ad4,
> page = listview.ListViewPage, path =
> 7:list-container:list:ad4.CustomListItem, isVisible = true, isVersioned
> = false]]
>     at wicket.MarkupFragmentFinder.find(MarkupFragmentFinder.java:110)
>     at wicket.Component.renderComponent(Component.java:1593)
>     at
> wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:691)
>     at
> wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:588)
>     at wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:476)
>     at
> wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:102)
>
>
> I looked through AbstractTree.updateTree code, but didn't find any
> special magic to insert new rows.. Please help!
>   
I found that special magic and there is A LOT of it :-((( First, it's in
TreeItem.onRender - old item renders itself and all new items below it.
And second, there's a hack in the Markup class:

// TODO Post 1.2: A component path e.g. "panel:label" does not match 1:1
// with the markup in case of ListView, where the path contains a number
// for each list item. E.g. list:0:label. What we currently do is simply
// remove the number from the path and hope that no user uses an integer
// for a component id. This is a hack only. A much better solution would
// delegate to the various components recursivly to search within there
// realm only for the components markup. ListItems could then simply
// do nothing and delegate to their parents.

Arrghhhh :((( I'll try to use decimal id's... Wicket is not so perfect
as it looks at the first glance :(

-- 
Andrew Klochkov


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to