cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic dataSource for table

0 Kudos
125

Hi,

I'm trying to change the dataSource of a table dynamically by using the method SET_DATA_SOURCE of the class CL_WD_TABLE.

A strange thing is that the parameter for this method is type ref to object... so what is this method expecting?

I always receive the same error:

"The following error text was processed in the system: Attribut NODE konnte nicht gefunden werden"

Even when I try the following, I receive that error:

lv_node_table = lr_table->get_data_source( ).

lr_table->set_data_source( value = lv_node_table ).

It seems pretty irrational to me that the result of the getter method seems to be the wrong parameter for the setter method...

I hope someone of you can figure out what went wrong here

Kind regards,

Maximilian.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

to ask a more specific question:

Has anyone ever successfully used the method "table->set_data_source( value = ... )."

If so, please post code examples!

Kind regards,

Maximilian

thomas_szcs
Active Contributor
0 Kudos

Hi Maximilian,

In order to change the binding path of the dataSource, please use method BIND_DATA_SOURCE. In case you would like to change the data, please use the bind_*() methods of the context node to which the dataSource binds to. Try to work with the model instead of with ui element. It's alot easier too, because the context is available everywhere while ui elements can only be accessed inside of wdDoModifyView without using back-channel methods.

Best regards,

Thomas

0 Kudos

Hi Thomas,

there is still a little problem left.

the binding seems to have no effect on the names and types of the colums.

The table still seems to have the old structure i.e. dataSource.

Regards,

Maximilian

thomas_szcs
Active Contributor
0 Kudos

Hi Maximilian,

That's intended. A developer is not enforced to bind all properties of aggregated view elements of a table to context attributes that reside below the dataSource. Some might be constant for all rows (like enabled, readOnly, etc) and hence are bound to other context attributes. Furthermore, the runtime is not able to determine which TableCellEditor should bind to which context attribute of the new dataSource. My advise it get the columns and to adjust the binding path of the table cell editors manually in your coding.

Best regards,

Thomas

Answers (1)

Answers (1)

0 Kudos

Thanks a lot : )