Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Answered

Label column headers dynamically

 Hi,


is there a possibility, to label column headers dynamically from a binding structure?


Thanks & Regards

Franziska

PNG

Best Answer

Hi Franziska


The Table Column Header can not be binded to a model. The problem is that the column label object is a sub object to the sap.m.Table and using the model from the Table, and not a structure. So normal binding is not possible.


To achieve the "binding" you need to add a small javascript in your Application.


Example:


Create a model based on a structure and name the different fields so you can read the content as the column header. If you call the object TableHeader the coding will be:


  

<yourColumID>.setHeader(new sap.m.Label({text:modelTableHeader.oData.COLUMN1}));

 

  

Replace yourColumnID with the name of the Column in NAD.


Regards

Ole Andre 




Hi Franziska


In NAD 3.0 there is not possible to bind the sap.m.Table headers the easy way. We will seek to implement a solution in the upcomming NAD 3.1 (March).


Regards

Ole Andre 

Hi,

I have the same Problem but I already run on NAD 3.1. Is this feature implemented in this?

Thanks and best regards
Marcel

 

Hi,

im sorry, i missunderstood this topic.
I have this Problem with the texts of legend 1-3 at the sap.viz Column chart.
Is there any possibilty to set this texts dynamically ?

Thanks
Marcel

 

Hi Ole Andre,


now we are working on NAD 3.1.

How is it possible to implement the dynamical column headers in the new version?


Regards

Franziska

Answer

Hi Franziska


The Table Column Header can not be binded to a model. The problem is that the column label object is a sub object to the sap.m.Table and using the model from the Table, and not a structure. So normal binding is not possible.


To achieve the "binding" you need to add a small javascript in your Application.


Example:


Create a model based on a structure and name the different fields so you can read the content as the column header. If you call the object TableHeader the coding will be:


  

<yourColumID>.setHeader(new sap.m.Label({text:modelTableHeader.oData.COLUMN1}));

 

  

Replace yourColumnID with the name of the Column in NAD.


Regards

Ole Andre 



Hi Ole Andre,

thanks!! In the online app it works fine!!

But where is the script in an offline app?

Regards
Franziska

 

Hi Franziska


You do the same for the offline App. But remember to store the "TableHeader" data in the WebSQL database by enabling the cache.


Regards

Ole Andre 

Hi Ole Andre,

the columns are all labeled.
But is it possible to name the sort-items also?

Thanks & Regards
Franziska

 

PNG
Login or Signup to post a comment