Forum Stats

  • 3,783,299 Users
  • 2,254,754 Discussions
  • 7,880,358 Comments

Discussions

How to hide or reset Horizontal scroll bar - table when there is no data

User_P8BY0
User_P8BY0 Member Posts: 18 Green Ribbon

using ojet11, when i clear the table Horizontal scroll bar not moving to starting position(0th Index) . Used scroll-position when i clear the table, it's not working,

Answers

  • Do you have a width set on the oj-table element? How are you clearing the table?

  • User_P8BY0
    User_P8BY0 Member Posts: 18 Green Ribbon

    Width is set to 100%

     if (typeof self.dataprovider !== "undefined") {

            self.dataprovider.resetAllUnsubmittedItems();

          }

          while (self.ActivityArray().length > 0) {

            self.ActivityArray.pop();

            self.dataprovider.resetAllUnsubmittedItems();

          }

    Thanks

  • This looks like you are trying to use a BufferingDataProvider. Can you please share the full code that initializes the BDP and the underlying DataProvider that it is wrapping?

  • User_P8BY0
    User_P8BY0 Member Posts: 18 Green Ribbon

    Yes, i am using BufferingDataProvider, its a editable table  

    this.dataprovider = new BufferingDataProvider(

                new ArrayDataProvider(self.ActivityArray, {

                  keyAttributes: "rowId",

                })

              );

  • John 'JB' Brock-Oracle
    John 'JB' Brock-Oracle Posts: 2,712 Employee
    edited Dec 1, 2021 5:52PM

    That API is only going to reset anything that you had edited and not submitted yet. It will not "clear the table" as you say you are trying to do. If you want to clear the table of all data, then you will need to reset self.ActivityArray that you've shown in the code example.

    I would initialize self.ActivityArray as an observableArray and then update it to [] and that should cause the table to clear.

    As another note, setting the width to 100% will only work if there is some kind of constraint on the containing DOM element as well. Try using something like 100vw instead if you don't have a static width defined on one of the parent DOM elements.