Page 1 of 1

Tabs - server response vs. client side

Posted: Fri Jan 07, 2011 10:14 am
by leatherlips
I have 3 tabs where all the content is initially built prior to displaying the "record format" for the first time.

I had added a tab response field and coded the RPG so it knew what tab it was on when it executed some bit of work off one of the tabs. (so I could return to the same tab it was on when it executed the item it was processing).

What I want to do, is be able to click on a tab without going back to the server, but when I execute some item on any of the tabs (that requires server action), I want to be able to return to the tab that the user was on when they performed the action/task.

Is it as simple as adding script to the onclick event, or will that mess up the "tab response" value and cause issues when I try to return to the same tab that an action was performed on?
(I hope the above makes sense)
Thanks

Re: Tabs - server response vs. client side

Posted: Fri Jan 07, 2011 12:07 pm
by Rob
There is a tab property called active tab. Bind this to a numeric field. If you set this field using RPG before the screen is displayed, you can control which tab will be displayed (the first tab is 0, the second is 1 etc). When a response is sent back to your RPG program, this field will also contain the number of the active tab.

Using this field, RPG can read and set the required tab on the tab panel.

Re: Tabs - server response vs. client side

Posted: Fri Jan 28, 2011 10:47 am
by leatherlips
Thanks! That works well. Is there also a way when clicking a tab, NOT to return to the server, but instead simply display the the tab that was clicked on? (client side)?

Re: Tabs - server response vs. client side

Posted: Fri Jan 28, 2011 11:47 am
by Rob
Yes. In fact this is how a tab panel is used in most cases. Clicking on a tab will only send a response to the server if the tab response property has an indicator bound to it.
If you want the tab panel to operate entirely on the client side, don't bind an indicator to this property (or unbind it: there is an unbind field button on the bind dialog).

Re: Tabs - server response vs. client side

Posted: Fri Jan 28, 2011 2:17 pm
by leatherlips
Good deal! I've give this a try.
Thanks