[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
setting focus in fixgrid  XML
Forum Index -> Development
Author Message
hartmann

Power User

Joined: 20/08/2008 16:27:48
Messages: 73
Offline

Hi,

when adding a new row to a fixgrid I want to set the focus into the first field of the added line. I tried like this:

public void onAdd(ActionEvent event) {
requestFocusFirstName = RequestFocusManager.getNewRequestFocusCounter();
m_grid.deselectCurrentSelection();
GridItem item = addRow();
m_grid.selectItem(item);
m_grid.ensureItemToBeDisplayed(item);
}
but the focus is set to first filed in first line.

What's the right way to do that?

Horst
 Filename demo.zip [Disk] Download
 Description
 Filesize 1 Kbytes
 Downloaded:  401 time(s)

hartmann

Power User

Joined: 20/08/2008 16:27:48
Messages: 73
Offline

Hi,

got the solution myself. Just define the 'requestfocus'-attribute in the rowitem:

public void onAdd(ActionEvent event) {
m_grid.deselectCurrentSelection();
GridItem item = addRow();
m_grid.selectItem(item);
m_grid.ensureItemToBeDisplayed(item);
item.setRequestFocusItem(RequestFocusManager
.getNewRequestFocusCounter());
}



sorry for wasting your time


Horst
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Hi,

there is a nicer way...:
FIXGRIDListBinding has a method "selectAndFocusItem". With this method the first focus-able component of the grid will be focussed, so you do not have to do the requestFocus-things. If the grid's columns are changed, then your requestFocus-management will not properly work (e.g. if the user re-arranges columns) - the "selectAndFocusItem" method will always focus the first one...

Regards, Björn

Björn Müller, CaptainCasa GmbH
levy

Power User

Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline

Hi,

I must provide the same behaviour for a ROWDYNAMICCONTENTBinding.
For example, lets look at the workpage "dynamic form" of the demo workplace:
1. Start the workpage
2. Add a lot of new comments until scroll bar appears
3. Scroll to the very bottom
4. Add a new comment
--> I would like the new comment to be visible

I have tried to set the focus by means of requestfocus-attribute, but it didn't work.

Any ideas?

Regards, Daniel
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

...it should work with the focus management - any component that is focussed should be scrolled so that is gets visible.

Does the focus itself move into the newly created field? (you can test by entering some characters just after the page was updated, then scroll down and check if the characters are shown)

Regards, Björn

Björn Müller, CaptainCasa GmbH
rheinrichs

Power User
[Avatar]

Joined: 08/05/2009 10:05:36
Messages: 209
Offline

Hi,

we have a problem with der FixGrid#selectAndFocusItem().
Sometime, e.g. a t:foldablepane is closed in combination with new Items, the function don't work for me.

Any idea? Need screenshots?

best regards
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

...yes, definitely need more info. Either screen shot, or screen sharing, even better.

Björn

Björn Müller, CaptainCasa GmbH
rheinrichs

Power User
[Avatar]

Joined: 08/05/2009 10:05:36
Messages: 209
Offline

... maybe there is a different problem with t:foldablepane?

(@see: screenshot)
[Thumb - bug2.jpg]
 Filename bug2.jpg [Disk] Download
 Description
 Filesize 35 Kbytes
 Downloaded:  349 time(s)

[Thumb - bug1.jpg]
 Filename bug1.jpg [Disk] Download
 Description
 Filesize 29 Kbytes
 Downloaded:  343 time(s)

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

OK... ...problem is (should be) solved with next update.
Thanks for telling us!


Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team