on 07-26-2006 2:01 AM
Hi All,
I am populating rows in a table by calling BAPI.
I set the selection property to 1..n for the context model node in view and custom controller.
I set the selectionmode property to multi for the table.
I have a "Select All" button in my view.
When i click this button, i want to select all the records in the table.
Then i want to loop thru the selected rows.
How can i do this?
Please give me some sample code or reference documents.
Thanks.
Hi Tiruna,
To select all elements in the node you can use following code (created by Valery Silaev) where select parameters indicate to "select" or "unselect":
public static void selectElements(final IWDNode node, final boolean select)
{
final int leadSelection;
if ( select )
{
leadSelection = Math.min
(
Math.max( 0, node.getLeadSelection() ), node.size() - 1
);
}
else
leadSelection = IWDNode.NO_SELECTION;
for (int i = node.size() - 1; i >= 0; i--)
{
node.setSelected( i, select );
}
if ( 0 < node.size())
node.setLeadSelection( leadSelection );
}
to iterate selected elements you can use:
for (int j = 0, n = wdContext.nodeRows().size(); j < n; ++j)
{
if (wdContext.nodeRows().getLeadSelection() == j
|| wdContext.nodeRows().isMultiSelected(j)
{
/* row at index j is selected */
}
}
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tiruna
If your data is coming from a BAPI another alternate solution would be to add a checkbox to your bapi table parameter. On clicking Select All on the view, pass this as a flag to your BAPI (field type wdboolean) and loop at the table in your bapi to set the checkbox field to X.
Bind this checkbox field to the corresponding checkbox column of the table in your view. This will maintain consistency in all the logic residing in BAPIs
Let me know if this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
I'd used the code listed above but i can't obtain a total visual selecting of all rows of the table.
I want to select / unselect by a simple button all the rows of a table and I would to see on the view all the rows selected into the orange frame.
Can everyone tell how do I proceed ??
Thanks a lot.
Message was edited by: Gianluca Barile
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.