cancel
Showing results for 
Search instead for 
Did you mean: 

automatic lead selection change line in WD table

Former Member
0 Kudos

Hi all,

In footer of WD table, there is an input field, where user can specify number of record, which will be shown in first visible line.

I need to automatically select this line as lead selection. How can I achieve this behaviour? ( I'm using NW 2004 SP 19)

Thanks for any answer.

Regards,

Juraj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Juraj,

Try the following:

1. In root context node create "integer" attribute FirstVisibleRow

2. In root context node create "integer" attribute FirstVisibleRowCalc, make it "calculated" and NW IDE will generate getter/setter

3. Bind "firstVisibleRow" property of table to FirstVisibleRowCalc attribute.

4. Write the following in generated "getter" method (get*FirstVisibleRowCalc):

return element.getFirstVisibleRow();

5. Write the following in generated "setter" method(set*FirstVisibleRowCalc):


element.setFirstVisibleRow( value );
wdContext.node<TableNodeName>.setLeadSelection( value );

In theory this should work, though I've never checked this in practice

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Valery,

<b>Kudos..</b>

I have tested the solution provided by you.

It works. Thanks for that.

I hope juraj you have solution.

Just follow waht valry has told. It works.

Hi Valery,

Their is a thread of mine where i need you advice and views

please give me some input.

Thanks

Shriram

Former Member
0 Kudos

Hi Valery,

thanks for nice solution.

Regards,

Juraj

Former Member
0 Kudos

The drawback of Valery's solution is that the application's functionality depends on the existance of this table footer.

Some clients (e.g. smart client) might not even have this footer at all (even the HTML client will not have it anymore in the next major release).

Armin

Answers (6)

Answers (6)

Former Member
0 Kudos

That's not possible with the standard footer.

As workaround, you can

- set the standard footer to invisible

- place an input field below the table with an action assigned to onEnter

- on the action handler, change the firstVisibleRow and the lead selection as needed

Armin

Former Member
0 Kudos

Hi Juraj,

Assuming that when first time the view containing the table is loaded their is no changes required.

Only when you enter some value in the input field then that record should be shown as first visible row ans should be lead selected.

Now,

1. Create a context attribute ctx_rowinput.Bind this context to the input field.

2. Create a action say onInputShow and associate this with the input field.

Either use a button and associate the action to the button or OnEnter event of input field.

3. In your action onInputShow();

public void onActionInputShow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

int i = wdContext.currentContextElement().getctx_rowinput();

wdContext.node<table node>().setLeadSelection(i);

}

4. In your wdDoModifyView add the following code

public static void wdDoModifyView(IPrivateTest_Table_View wdThis, IPrivateTest_Table_View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(!firstTime)

{

IWDTable table =(IWDTable)view.getElement("Table");

table.setFirstVisibleRow(wdContext.currentContextElement().getctx_rowinput());

}

//@@end

}

<b>Note: If you enter 3 in the input field it will show 2 record as the node index

starts from 0.And also before setting the leadselection and visible row check if

the input value exceeds the nuber of rows in the table.</b>

This has worked for me.

Former Member
0 Kudos

Hi Shriram,

thanks for your response.

but I need to do this for generic input field in footer of table, not for input field created by me. Or can I access this generic input field events?

Regards,

Juraj

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

has that field come from TableToolbarItem?

do you want to access that field?

regards

Former Member
0 Kudos

Hi Juraj,

Any UI element if gets embedded in any other UI element, even then the embedded UI

element has its propertiese. Check in the outline view of your NWDS.

If you can get the propertiese of the input field then check if their are any events associated with that.In case events exists then you can

associate the action with this event.If not then you have to declare a button or something with

which you can associate the action.

Former Member
0 Kudos

Hi Abhijeet,

no, field is not from toolbar.

When I set property of table footerVisible = visible, in runtime I get footer of table with buttons {Next, NextPage, End, Previous, PreviousPage, Begin} and one input field for row specification. So that's input field a want to access.

My previous descriptions probably wasn't so clearly, sorry for them.

Regards,

Juraj

Former Member
0 Kudos

Better bind "firstVisibleRow" to a context attribute and set the attribute value in the action handler.

Armin

Former Member
0 Kudos

Hi Juraj,

Thats not possible. I tried to check but nothing.

You cannot that input field atleast presently.May be future versions

may have that implementation.

But for now if its that needed then you have to go for a workaround.

@ Armin,

can you just go through the follwoing thread. I need you views on that.

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi Juraj,

okay so you want to display, whichever no is enterd, as a lead selected first line in a table.

find the <b>dataSource</b> bound to the table and simply write this line on the action in which you want to acieve above result;

wdContext.node<node of dataSource bound to the table >.setLeadSelectionwdContext.currentContextElement().get<context element where you wil get the no.>);

this will select the corresponding row and also set it as lead selected.

hope it helps

let me know if you have any problem

regards

Former Member
0 Kudos

Hi,

If the table bind to node that initialize lead selection is defaultly true. That means your initial first record is selected defaultly.

After clicking the first record the second time it is not clickable.

and one more thing when move to another view from the firstview table to another view if you come back from another view to table view first record is not clickable.

For this u need to do the make initilize lead selection is set to false and come back from another view to table view on the second view action u need to add this condition.

wdContext.node<tableNode>().setLeadSelection(-1);

Thanks,

Lohi

Former Member
0 Kudos

Hai,

Create a context attribute of type integer bind it to inputfield value and bind it to the table property firstVisibleRow.

Regards,

Naga

former_member286976
Active Participant
0 Kudos

Hi Juraj,

See the javadoc for <a href="https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/uielib/standard/api/WDTableSelectionChangeBehaviour.html">WDTableSelectionChangeBehaviour</a> and try to set this.

Regards,

Sudeep

Former Member
0 Kudos

Hi,

this looks interesting, but this API is for NW2004S... I'm using NW2004.

Thanks for response.

Regards,

Juraj