cancel
Showing results for 
Search instead for 
Did you mean: 

How to set values to the table rows

Former Member
0 Kudos

Hi all,

I created a table in application. when i click add button the rows are incremented automatically. i have to generate a number sequentially with a table row. that also i did it.

I created one more button for delete row. it is also working, but i dont knoe how to set the auto generate number correctly.

Its very urgent. If any ne of u know plz let me know plz.

thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks a lot for all your answers.

The table has first column as SNO, i generated this automatically, when i click the addrow button.

but what i want is, if i delete any one of the table rows the SNO of the deleted row have to be adjusted with other rows of the table automatically.

for ex: if i have 5 rows in the table, if i delete the 3rd row means, the SNO of 4th & 5th row have to be changed as 3 & 4 when i press the delete button.

Expect your results as early as possible.

Thanks in advance.

Former Member
0 Kudos

Hi Santosh,

I think you can do something like this:

In your deletion code after code for deletion, try this:


int nodeSize = wdContext.node<table source node>.size;
for(int i = 0; i < nodeSize; i++){
wdContext.node<table source node>.setLeadSelection(i);
wdContext.node<table source node>.current<table source node>Element.set<row number attribute>(i + 1);
} 

Check if this works.

Regards,

Satyajit.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

Using the calculated attribute for the RowNo and using the Getter method as suggested by Armin should solve you problem of updating the SNO after deleting the rows.

In this approach you need not write any code for updating SNO.

Regards,

Ajay

Former Member
0 Kudos

Thanks for all people for your kindly help.

I solved the problem

Former Member
0 Kudos

Do you want to show a row number in the first column? If yes, add a table column, cell editor = TextView.

Add a calculated attribute "RowNumber" (integer, read-only) under the data source node "Rows".

Bind TextView.text property of the cell editor to attribute "RowNumber".

Implement the get-method:

int getRowNumber(IRowsElement element)
{
  return element.index();
}

Armin

Former Member
0 Kudos

Hai Santosh,

You can try this code

int size=//your model data size

ArrayList al=new ArrayList();

for(int i=0;i<size;i++){

IXXXView.IXXElement ele=wdContext.createXXElement();//the element is which node you bind to the table

ele.setX(your needed value);

ele.sety(your needed value);

al.add(ele);

}

wdContext.nodeXX.bind(al);

regards,

Naga Raju

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

U can wtite the code while adding the row itself.

wdContext.CurrentContextElement.Set<Attribute>(number);

Regards,

Vijayakhanna Raman