PDA

View Full Version : OnRowOut doesn't work as I wish



aminef
10 Dec 2010, 9:46 AM
I am having a column in my grid that contains a button, this button is visible after onRowOver and hidden after onRowOut from my gridView :

http://img20.imageshack.us/i/mouseover.jpg/


@Override
protected void onRowOver(Element row) {
super.onRowOver(row);
int rowIndex = findRowIndex(row);
//take last column
Button b = (Button) getWidget(rowIndex,getColumnData().size()-1);
wb.setVisible(true);
}
@Override
protected void onRowOut(Element row) {
super.onRowOut(row);
int rowIndex = findRowIndex(row);
final Button b = (Button) getWidget(rowIndex,getColumnData().size()-1);
b.setVisible(false);
b.addListener(Events.OnMouseOver, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
b.setVisible(true);
}
});
}

but of course when my mouse cursor is over the button, it's considered as Out of the Row (onRowOut ==> not visible anymore) so I tried to keep it visible when my mouse is over this button, but I am still having issues doing it.

Any ideas?

sven
10 Dec 2010, 9:55 AM
Edited my post.

Which version of GXT are you using?

aminef
10 Dec 2010, 10:00 AM
hmmm I see...
Thank you sven, I will try to implement it by myself in that case. I will keep the thread updated if anything is done from my side.

sven
12 Dec 2010, 6:48 AM
Which version of GXT are you using?

You probably also need to increase the rowselectordepth, as the button adds markup. There is a setter on the view.

aminef
13 Dec 2010, 7:37 AM
I am using the 2.2.0
and what I did is basically the opposite algorithm (when you have onRowOver and onRowSelect, you hide the other buttons from other rows)

here is the code of my customized GridView if anyone is interested (I do the same onRowSelect)


protected void onRowOver(Element row) {
super.onRowOver(row);
for(int i = 0; i < getRows().getLength(); i++){
Button b = (Button) getWidget(i,getColumnData().size()-1);
b.setVisible(false);
}
int rowIndex = findRowIndex(row);
//take last column
Button b = (Button) getWidget(rowIndex,getColumnData().size()-1);
b.setVisible(true);
}

sven
13 Dec 2010, 7:40 AM
As you use GXT 2.2.X you simple need to increase the rowselectordepth and should not need any further workarounds

aminef
13 Dec 2010, 7:43 AM
What does rowselectordepth exactly reflect?
If I set it to a higher value, will it look at the button as a part of the row? (so no more confusion on the onRowOut?)

sven
13 Dec 2010, 7:45 AM
If I set it to a higher value, will it look at the button as a part of the row? (so no more confusion on the onRowOut?)

Yes

aminef
13 Dec 2010, 7:48 AM
Sorry sven, but I am not able to find any help/documentation about what exact effect the value change of rowselectordepth has. Would you mind giving me a link on a thread already open on the forum, or an outside link to check it out?
I couldn't find anything on the forum

sven
13 Dec 2010, 7:52 AM
It sets the maximum depth an element can have so it still counts as part of the row.

aminef
13 Dec 2010, 7:59 AM
I just set it to 25 and it works fine perfectly!
but I am sorry to ask the same question one more time ( I didn't really understand the 1st explanation) : rowselectordepth is the max number of elements a row can contain/affect during an event handeling?

sven
13 Dec 2010, 8:10 AM
Its the total count it walks up the dom tree until it reaches the row element. If its not high enough, it maybe does not walk up enough and so never finds the row element.

aminef
13 Dec 2010, 8:10 AM
Thank you so much sven!