cancel
Showing results for 
Search instead for 
Did you mean: 

SelectAll Option for a tabel

Former Member
0 Kudos

Hi all,

i am having a tabel with some data which is fetched from R/3 system.Now i have to delete some records selected by the user form R/3 system means user may select multiple rows also..

How is it possible for a Table component in webDynpro..At a time only one row is getting selected but if i hold (keyboard key)control and click on others rows then only multiple rows are getting selected.

Is there any alternate way that user can select multiple rows directly with mouse itelf

Regards

Padma N

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

try this code,

for(int i=wdContext.node<Node>().size()-1;i>=0;i--)

{

if(wdContext.node<Node>().isMultiSelected(i) || wdContext.node<Node>().getLeadSelection()==i)

{

// Perform delete operation for row i

}

}

Otherwise you can use checkbox in table for this.

Regards

LakshmiNarayana

Former Member
0 Kudos

Hi LakshmiNarayana ,

wat it mean if(wdContext.node<Node>().isMultiSelected(i) actually and

how to keep checkboxes in my table..should that checkboxes be a sepeare column....

i am having a table with 5 fileds which are already mapped with R/3 model...

it is not giving permission to update the tabel with one more column for checkboxes

Regards

Padma N

Former Member
0 Kudos

HI,

I actually mean it to check for each row , selected ot nor When selecting using key "ctrl"

if(wdContext.node<Node>().isMultiSelected(i) means if i'th tow is selected?

Regards

LakshmiNarayana

Former Member
0 Kudos

Hi Padma,

No need for check boxes when already multiple selection is available in a table. without using ctrl key , u can't select multiple rows.

(wdContext.node<Node>().isMultiSelected(i) means when u loop thru the node ,u r checking whether the row "i" is selected or not.

regards

Sumit

Former Member
0 Kudos

Hi Sumit ,

Can u plz tell me wat to do to my tabel to select multiple rows at a time .

My table has SelectioMode multi and has 3 colums which are already binded to a R/3 modell

Regards

Padma N

Former Member
0 Kudos

Hi,

There are two ways

1) Either select all tables rows while loading

Ex code

for (int x=0; x < wdContext.node<Your node bound to table>().size(); x++)

{

wdContext.node<Your node bound to table>().setLeadSelection(x);

}

2) Create a button and do the same mentioned above

Regards

Ayyapparaj

Former Member
0 Kudos

Hi all,

i dont want to select all while loding..

Here user has to select at runtime

Regards

Padma N

former_member751941
Active Contributor
0 Kudos

Hi padma,

Write the code inside action of delete button.

1> For Check box.

isChecked(boolean) value atttribute under ValueTableNode that is bound to the table.

int n = wdContext.node<ValueTableNode>().size()

for (int i = n - 1; i >= 0; --i)

{

if(wdContext.nodeValueTableNode().getValueTableNodesElementAt(i).getIsChecked())

{

//write the code for delete record using RFC .

wdContext.nodeValueTableNode().removeElement(wdContext.nodeValueTableNode().getElementAt(i));

}

}

2> If you are not using check box then

int n = wdContext.node<ValueTableNode>().size();

int leadSelected = wdContext.node<ValueTableNode>().getLeadSelection();

for (int i = n - 1; i >= 0; --i) {

if (wdContext.node<ValueTableNode>().isMultiSelected(i) || leadSelected == i) {

//write the code for delete record using RFC .

wdContext.nodeValueTableNode().removeElement(wdContext.nodeValueTableNode().getElementAt(i));

}

}

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f699f90-0201-0010-14a4-8950177281ed">Developing with Tables in Web Dynpro</a>

Regards,

Mithu

Former Member
0 Kudos

Hi Padma,

If ur table is having selection multi, just change the binded node's selection property to 0.n. nothing else is required. user can select the rows with ctrl key pressed.

regards

Sumit

Former Member
0 Kudos

Hi,

In the given code only user can delete one record at a time not multiple..If user wants to delete multiple records with mouse selection with out using Cntrl key its not possible i think


2> If you are not using check box then

int n = wdContext.node<ValueTableNode>().size();
int leadSelected = wdContext.node<ValueTableNode>().getLeadSelection();
for (int i = n - 1; i >= 0; --i) {
if (wdContext.node<ValueTableNode>().isMultiSelected(i) || leadSelected == i) {
//write the code for delete record using RFC .
wdContext.nodeValueTableNode().removeElement(wdContext.nodeValueTableNode().getElementAt(i));
}
}

Regards

Chandrashekar.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Padma,

Also try this:

Set the table property "compatabilityMode" with value 'nw04Plus'.

Make sure that the cardinality of the node element is set to 0..n

And make sure that you have added atleast one row to that context node(which is binded to the table) before you want to edit any field.

I am able to achieve this in my application. If you still have some problem just give me more details about your application.

Regards,

Kiran Chennapai

Former Member
0 Kudos

Hi,

I think...few users may complain about selecting multiple rows by holding ctrl key.

So they will ask us to provide the functionality like just one click on each row without holding the ctrl key.

In such situations we have to use one extra column(check boxes) as the first column in the table.

And we can remove the standard selection column by setting that parameter selectionMode as "none".

In your logic when ever you want refer to perticular row..just refer to the field which has that check box field as "ticked".

I hope this will resolve your problem and make user feel comfortable with the table operations.

Regards,

Kiran Chennapai

Former Member
0 Kudos

Hi Kiran,

In my Context i created a valueNode as ChkNode and ValueAttribute as ChkVal and i added one column to my table and i binded ValueAttribute to Chkbox.

and i kept the selectionMode property to NONE .

but the problem is the Chkbox colum of table is not in editable state..so that user is not able to select any checkbox.

How to make the column of the table which has checkbox to editable so that user can select multiple rows with mouse rather than control Key.

Regards

Padma N

Former Member
0 Kudos

Hi,

Set the cardinaliry of the node to 1..n

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Padma,

take the refference of the check box in ur modifyView & make it enabled there.

IWDCheckBox c = (IWDCheckBox)view.getElement("chkbx id");

c.setEnabled(true);

regards

Sumit

Former Member
0 Kudos

Hi Ayyapparaj ,

My checkboxes column is not comming in editable state.

I created a ValueNode with cardinality 1..1 and selelctioNode is 0..1

the ValueAttribute is of type boolean .

i mapped Texts Property of checkbox to that valueNode

Wat abt Checked Property of the CheckBox Column.

Wat to do to make that column editable so that user can select multiple rows at runtime

Regards

Padma N

Former Member
0 Kudos

Hi Padma

You need to bind that boolean attribute to the CHECKED property.

Best Regards

Chaitanya.A

Former Member
0 Kudos

Hi,

You can create a separate value node with all the fields as in your existing node(dont use structure binding, just copy only the fields)and add another column for check box(boolean type).

Remeber to set the table control parameter selectionMode to "none" to increase the table control performance.

And apply the logic as it required.

Regards,

Kiran Chennapai