Skip to Content

show or hide duplicate records for sap.m.table

Hi Experts,

I have a requirement. I have to show or hide the duplicate records for particular row based on the button click for that row. I used mergeDuplicates property but its showing initially and it is applying for all reocrds. But i want that based on button click and only for that record.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 30, 2017 at 07:30 AM

    Hi Ashok ,

    Actually merge duplicates will only allow to merge field values like kind of grouping(Batch field).

    It could be done in many ways but i think of this solutions :

    Before binding the list of items(object) to the table you can add a field 'visible' to each object in the array of data.Just for the first entry you can make visible true and for the duplicates one if present to false.

    {"Batch":"1","BatchDesc":"batch1",visible:"true"},

    {"Batch":"1","BatchDesc":"batch1",visible="false"},

    and on the press of the button just get the pressed row Batch value and the whole table binding and change the visible property of each object in the table binding to true whose Batch value equal to batch value of the row pressed.

    thanks

    Viplove

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 30, 2017 at 05:47 AM

    Thanks for your reply.

    I have a table with 3 columns(batch,batch description and add button). Let say I have 6 records.

    arrar=[

    {"Batch":"1","BatchDesc":"batch1"},

    {"Batch":"1","BatchDesc":"batch1"},

    {"Batch":"2","BatchDesc":"batch2"},

    {"Batch":"3","BatchDesc":"batch3"},

    {"Batch":"3","BatchDesc":"batch3"},

    {"Batch":"4","BatchDesc":"batch3"}

    ]

    When I set this data to my table, I have to show only 4 records(no duplicate). If I press the button for any row I have to show duplicate record for that particular batch.

    Ex: If I press the button for batch one , my output screen has to show 5 records

    {"Batch":"1","BatchDesc":"batch1"},

    {"Batch":"1","BatchDesc":"batch1"},

    {"Batch":"2","BatchDesc":"batch2"},

    {"Batch":"3","BatchDesc":"batch3"},

    {"Batch":"4","BatchDesc":"batch3"}

    Thanks,

    Ashok.

    Add comment
    10|10000 characters needed characters exceeded