How to clear tabs while navigating within tabbedpanle in wicket - wicket

I'm building a tabbedpanel which consists of three tabs. I have a tab with form with text fields in it. while I am navigating from this tab I'm unable to loose the state of this tab. Can anyone suggest how to get around it?

Is the Form/ around the TabbedPanel? If YES then you can override
org.apache.wicket.extensions.markup.html.tabs.TabbedPanel#newLink()
And do something like:
form.setModelObject(new EmptyObject())
Or:
form.setModelObject(null)
Or:
use a visitor to set "empty"/null model for each FormComponent in the complete form
Or:
Just in the specific tab by using the passed 'index' parameter to #newLink().

Related

flutter- getx nested routes with tab

I am going to build flutter app with Getx.
I followed nested navigator from
https://github.com/jonataslaw/getx/issues/799#issuecomment-730719165
at this example, only shows 1 step sub routes like "/browse".
I need to make another sub routes like "/browse/tabX" and "/browse/tabY"
when click browse button from BottomNavigationBar, It shows tabs (tabX and tabY) on the top. and tabX is default selected.
for the body, it shows automatically their pages.
Also using Get.Named('/browse/tabY') can access to open their page(select second tab and show their body).
Can you help me?
Oh Now I got the answer!
What I make a mistake is I did not use "sub-name".
for example, at initialRoute,
I used '/home/browser' but it should be '/browser' if it is sub-route.
Because the concept is route to subrouter's root and handle by subrouter.
so "initialRoute from root" route to /home first.
and "initialRoute from subroute" route to /browser again!
I use classed variable instead just string so I did not figure this difference out.

Setting values to a form which is not rendered yet

I have a form within a tab. It is second tab so it doesn't render until you open it.
I have tried to submit data to the form with Ext.getCmp('DetailsForm').getForm().setValues(selections[0]); but it says that it is not a function. Probably because it is not rendered yet. What I have to do?
Set the deferredRender config property of your Ext.tab.Panel to deferredRender: false
That will force the rendering of all tabs instead of just active ones. Now the form will be there. As mentioned before I recommend you also to use myTabPanelRef.down('from').getForm().setValues(selections[0]); to access the form.
subscribe to the second tabs show event OR painted event
then look for the form preferably by using .down() method as this wont look with in the entire DOM.
set the values
Use render event of form panel.
Your code will be something like this -
Ext.getCmp('DetailsForm').on('render', function(){
this.getForm().load(selections[0]);
});

overriding setResponsePage() to build breadcrumb

I 'm trying to build my own simple breadcrumb component that pushes a PageRefence onto a List for each and every Link in the application.
Unfortunately, setResponsePage() is final (I use wicket 6).
The only other option that comes to my mind is to add a parameter to my base page constructor. But this would require me to change every link in the app..
Are there any other options?
Since you already have a base page, it's easier to override onBeforeRender() in your base page to update the breadcrumbs list that you'd store in your Session object.
Or am I missing something?
To answer my own question:
In the end I realized, that I do not want to have the breadcrumb updated on each new page.
Therefore I created an object that holds a List of Pagereferences. When I navigate to a new Page, I take the list of the current page, make a copy of it an add the current page. The resulting list is pased onto the new page.
All this is handeld in the base page.
Keeping it in the page, avoids problems with multiple tabs / windows.
Thanks for the help.

How to find in GSP from which action of controller its been called?

I am new to grails and i got stuck with another issue.
I have two form's in my single GSP search.gsp and have two actions in my controller serach and results.
Now when i click on search button in one of my GSP file it takes me to search action which renders me search.gsp.At this time it should display me only first form in it. when i click results button in that form it will take me to results action.which has code line.
redirect(action:"search",params:[merchants:merchant,address:address])
this will take me back to search action but now i want to display 2nd form in search.gsp..
My problem is
how can i make search action once to run with out parameter's and once with parameter's?
how to determine in GSP from which action its been called?
with Advance thanks.
Depending on how different your forms are, you may want to consider having two separate GSP files (e.g., search.gsp and results.gsp). Use render(view:'action', model:[...]) to render a different view in the controller. This is often clearer that a single file with lots of conditionals.
Otherwise, you can find out the action using ${params.action}, so for example:
<g:if test="${params.action == 'search'}">
Text to show if the action is search
</g:if><g:else>
Text to show if the action is results
</g:else>
I would suggest you to separate your result page as template (_search.gsp), and render it from your result action. So that's how you will have different forms in different files.
By the way template is nothing but an ajax response, google it for detail about template in grails.

Zend Framework: Hide navigation item in menu by show in breadcrumbs

i am using Zend_Navigation i want to show the nav item in the breadcrumbs but hide it in my menu, how can i do that?
There are many choices, e.g.
You may set visible parameter to false (eg. in xml config file), then use setRenderInvisible(true/false) on the navigation helper,
You may use separate containers,
You may modify the container on the fly (getContainer(), getItemBy()…)
When using an XML config file, use an integer instead of a boolean value:
<visible>0</visible>
An issue has already been logged for this problem here.