on ‎2013 Apr 29 11:49 AM
| Header 1 |
|---|
| Value1 |
| Value2 |
| Value3 |
| Header 2 |
|---|
| Num1 |
| Num2 |
| Num3 |
| Header 1 | Header 2 |
|---|---|
| Value2 | Num3 |
Request clarification before answering.
Hi,
I am attaching the code that I have written so far.
Also below is my screen design:
User first selects a value in Legacy Table table, then selects a value in the SAP Fields table.
On selection of second value, I am writing code to create a third table and put these 2 selected values in a single row with 2 columns, but the output appears as below:
First value is coming in the first column and first row, however the second value is coming in the second column's second row instead of first row.
Also I want to keep adding rows to this table as the user continues selecting values in the above 2 tables, which I would not be able to achieve using the attached code.
Can anyone please point me out in the right direction how to do this?
Regards,
Saurabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurabh,
If you want to use the model approach then you will need to merge the existing data in the model with the new data...you could try something like this inside your rowSelectChange event handler:
var rows = [{header3: tab1FieldName, header4: tab2FieldName}];
currentData = oModel3.getData();
if(currentData.modelData){
rows = currentData.modelData.concat(rows);
}
oModel3.setData({modelData: rows});
Creating the model (oModel3), setting the model to the table (oTable3) and binding table rows, and placing the table could all probably be done outside of the event handler as it only needs to happen once.
Hope this helps.
Cheers,
Ian
Hi Saurabh,
based on my knowledge ..
Get the Context for the selected row .Get the value and set this value to any element such as text field using
setValue(sValue) : sap.ui.commons.TextField .or directly bind the context to the element using setBindingContext method for that corresponding property
- Add this element to the cell
- cell to row using getCells() : sap.ui.core.Control[]
- row to the table addRow(oRow) : sap.ui.table.Table
Regards,
Jibin Joy
Hey Vakil ,
Can you Put your code after you corrected the error you had 😕 it might be helpful, since me too have the same problem.
Insert the full code or From the oTable2.attachRowSelectionChange(function(oEvent)
Since i could not correct the Mistake which you have...
After putting the below code and binding i cant understand
var rows = [{header3: tab1FieldName, header4: tab2FieldName}];
currentData = oModel3.getData();
if(currentData.modelData){
rows = currentData.modelData.concat(rows);
}
oModel3.setData({modelData: rows});
I Tried this Code But not working
var rows = [{header3: tab1FieldName, header4: tab2FieldName}];
var oModel3 = new sap.ui.model.json.JSONModel();
currentData = oModel3.getData();
if(currentData.modelData)
{
rows = currentData.modelData.concat(rows);
}
oModel3.setData({modelData: rows});
oTable3.bindRows("/modelData");
oTable3.placeAt("uiArea1");
});
This is not working frnd
var oModel3 = new sap.ui.model.json.JSONModel();
var rows = [{header1: tab1FieldName},{header2: tab2FieldName},
{header3: tab3FieldName},{header4: tab4FieldName},
{header5: tab5FieldName},{header6: tab6FieldName},
{header7: tab7FieldName},{header8: tab8FieldName},
{header9: tab9FieldName}];
currentData = oModel3.getData();
if(currentData.modelData){
rows = currentData.modelData.concat(rows);
}
oModel3.setData({modelData: rows});
oTable3.setModel(oModel3);
oTable3.bindRows("/modelData");
oTable3.placeAt("dataTable");
});
Their is same problem even after putting this Code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.