Skip to Content

Triggering a $top for SmartTable

I have a SmartFilterBar & SmartTable which work successfully in conjunction with each other. However, the user wants to have a provision by which he can specify the maximum number of search results. I had so created a custom checkbox & input field which would provide the user with the same.

So in the example below since the user has specified to restrict the results to 2 only a maximum of 2 records ought to be displayed to the user.

However, I haven’t been able to understand how I can pass in this value for filtering the search results count. I was trying to see if I could pass in a $top=2 somehow to the gateway call but just couldn’t figure out as to how & where to do it as the gateway call is happening automatically without any coding from my end. Any inputs would be greatly appreciated.

capture.jpg (50.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 09, 2018 at 01:05 AM

    Its best advised to let the framework handle the pagination (top and skip implementation) else you need to calculate their values continuously for every call. Still if you want you can try as below. Bind the control in view to a JSON model and fill the data in the model via oData model's read call. Here you can pass the values for top and skip explicitly.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Ankit,

      Thank you very much for your inputs on how I can realize the requirement. Well I ended up getting onto a different contract & so never got to actually take this any further but as always its good to know as to how I should have approached the issue if the client persisted over meeting the requirement!

  • Feb 12, 2018 at 01:57 PM


    I'm completly agree with Former Member let the framework do the job.

    But If you want set up the pagging system you should do it in the onBeforeRebindTable, look at the help

    If I were you, I will not do it ;)



    Add comment
    10|10000 characters needed characters exceeded

    • Hi Joseph,

      Thank you very much for adding your views to what Ankit had suggested & passing on the info about implementing the event onBeforeRebindTable. I shall pass on the information the guy who took-over the task from me. Having gone through both of your comments I would have rather tried to push back the clients requirement & tried to persist with the frameworks standard behaviour!