cancel
Showing results for 
Search instead for 
Did you mean: 

Editable row (1 column) in Table

Former Member
0 Kudos

Hello,

Maybe somebody has solved such problem

I have a Table and few columns in it.

I need to have every third row in one of the columns

editable. First I have created standard Table element

Bind it to my RFC function table.

I was trying also to create within a table

one column with type of InputField but when I run

my application this column is still not editable.

Maybe somebody has some idea how to manage (and make every third row editable?

Thank you very much in advance

Bogusia

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think I found the solutions but both are not satisfying

1. I have created new column:

- I have created by using right-menu

Insert TableCellEditor an InputField

Now I see that column is editable but...

I have to click a row (row must be marked) to be

able to write something and I do not like

it because I want that user has not to wait

while the row will be marked.

2. I have created Master Column

- Like above using TableCellEditor (InputField)

I see now that all rows in column are editable

without a neccesity of marking single row

but the column has strange arrows at the begining

and when I click on them error occurs...

Maybe somebody has an idea and also for only the every third row editable?

Thank you in advance

Bogusia

Former Member
0 Kudos

Hello

I have to again answer myself

First solution works.. I forgot to rebuild a project

I can edit column, but I sill look for the possibility of edit only every third row ...

Thank you.....

Bogusia

former_member182372
Active Contributor
0 Kudos

Hello Bogumila,

Create calculated attribute under your data node with type boolean (readOnly). Map property Read only of InputField cell editor to this attribute. And in calculation method put:

  public boolean getResultEditable(IPrivateNewComponentView.IResultElement element)
  {
    //@@begin getResultEditable(IPrivateNewComponentView.IResultElement)
	final int index = element.index();
    return !(index%3==0);
    //@@end
  }

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hello Maksim,

Thank you for answer could you write me maybe

more detail description I mean step-by-step instruction

how to create calculated attribute and what does it mean data node? (Local dictionary /Data Types maybe?)

Greetings and Thank you

Bogumila

Former Member
0 Kudos

Hi Bogumila,

You have bound some value node/model node with the table ui element.

Now make one value/model attribute inside this node.

Set its calculated property to "true". and set type to boolean.

It generates its setter and getter method. In getter method write following code.

if(element.index()%3 == 0)

{

return true;

}

else

{

return false;

}

Now, bind this newly created value/model attribute with the table celleditor's read only property.

Regards,

Bhavik

Former Member
0 Kudos

Thank you!

Former Member
0 Kudos

Small enhancement:

Set readOnly=true for the attribute and the set-method disappears.

Armin

Former Member
0 Kudos

Hello

Everything works fine now BUT...

I do not know how to read the current number

of row.. element.index does not work ....

some ideas?? Thank YOU!!

Bogusia PL

Former Member
0 Kudos

Number of rows in table = size of data source node

Armin

Former Member
0 Kudos

Hi Bogumila,

It is working perfectly for me.

Have you bound that boolean attribute to the read only property of your column's cell editor?

How you checked that it is not giving you index value?

Regards,

Bhavik

former_member182372
Active Contributor
0 Kudos

Hello Bogumila,

1) Create firstVisibleRow attribute with type integer. Map it to table property firstVisibleRow.

2) Create visibleRowCount attribute with type integer. Map it to table property visibleRowCount. In method wdDoInit set it to appropriate value (5 for example. it is default value. increase or reduce as necessary)

3) To calculate index of selected row you can use following code:


int visibleRowCount = wdContext.currentContextElement().getVisibleRowCount();
int index = wdContext.nodeResult().currentResultElement().index();
int firstVisibleRow = wdContext.currentContextElement().getFirstVisibleRow();

return 
	((index >= firstVisibleRow + visibleRowCount) || (index < firstVisibleRow) ? 
	-1 : 
	index - firstVisibleRow + 1);

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Thank you for everybody!:

MY STEP-BY-STEP SOLUTION:

1. Create in a Context for View but! on the Diagram Model level (to do this double click on the Your Component/double click on the arrow between your View and a Model) and create WITHIN your table new Attribute Value

(not outside!!! I have done it and the number of row was not visible in the implementation) right-menu-> New->Attribute Value and give it a name..

Go back to View -> Go to tab Context

than select in table your newly created Attribute Value

Go to the Properties of this Attribute

Set:

-calculated: True(after doing it you see below 2 new methods they will be also added to the Implementation

of your View)

-type: boolean

Go to the Outline then to a table column and its attribute you want to change (in my case that was: ReadOnly Attribute) to the Properties, set as a value for ReadOnly the Newly Created Attribute Name.

Go to the Implementation of your view

and find the getXXXXX method which was created

after clicking true for calculated properties

for Your Attribute Value.

I have used such solution for implementation:

(I need to have every third row in specific column editable)

The code is:

public boolean getMyObjectReadyOnly(IPrivateResultView.IMyObjectElement element)

{

//@@begin getMyObjectReadyOnly(IPrivateResultView.IMyObjectElement)

int i = element.index() + 1;

if (i % 3 == 0){

return false;

}else{

return true;}

//@@end

}

That was really simple...

With greetings

Bogusia

Thank you very much to all for your support

former_member182372
Active Contributor
0 Kudos

Hello Bogumila,

If the problem is solved, please, assign points and close thread.

Best regards, Maksim Rashchynski.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Bogumila,

As u asked what is a data node?A data node is a collection of different attributes.An attribute is just like a variable that holds ur data.But the node is where u can hav multiple values for a single attribute.

Local dictionary is a place where you can create ur simple types.Simple types are nothing but just a storage area of values that is being used in the drop down box,radio buttons etc.

Hope this satisfies ur queries.

Regards,

Nagarajan.