Search code examples
oracle-jet

Hide ojPagingControl if there is no data to show in Ojet


If there is no data to show in ojTable I want to hide the table and pagination. I can able to hide the ojTable but not the pagination. How can I hide the pagingcontrol if there is no data?


Solution

  • I would use a KO virtual binding around the pagination element.

    Something like this:

    <!-- ko if: pagingDatasource.dataSource.data.length == '0' -->
    <div id="paging" data-bind="ojComponent: {component: 'ojPagingControl', data: 
     pagingDatasource, pageSize: 15}">
    </div>
    <!-- /ko -->
    

    With the above code, if the length is zero, the paging element won't be added to the DOM at all.