6

I'm trying to remove rows from a list view webpart using JSLINK, I used the code from this link Remove rows from list view webpart, I'm able to remove the rows as expected but this is affecting the paging in that webpart, I noticed the paging count is not updated correctly. i.e. I have 7 items left and a page count of 30 - but the paging is displayed with 1-6 and 31-7. how to fix this.?

Added to that, the list view webpart headers renders the removed row items text for filtering, how to remove the items from header ?

  • We had similar problem with JSLink in past. It is impossible to maintain paging if we remove items using JSLink. Instead of using JSLink, use item level permission for this kind of issue. – Samir Khimani Jul 17 '17 at 8:05
  • I wouldn't remove/delete the rows, but rather hide them or the information inside. – Mike Jul 17 '17 at 20:06
  • @Mike, consider that there are 3 rows in my list, now if I want to hide the 2nd row then first and third row will be separated by a blank row because I would have hided the 2nd row. This will not look good. – Karthik Jaganathan Jul 18 '17 at 4:19
  • depends on how you hide it, but I agree. You've tried changing the "LastRow" field in Option 1 of your link with no avail? – Mike Jul 18 '17 at 13:07
  • 1
    Which are the condition to remove rows? Perhaps you can use different approach than jslink... – Juan Pablo Pussacq Laborde Jul 18 '17 at 14:42
5
+50

You can't.

The ListViewWebPart does loading and paging on the server-side. If you now remove the rows using JSLink they'll be simply "hidden" (kind of) on the client side. The ListViewWebPart knows nothing of what you did and "thinks" the rows were all rendered.

1

As the @Nils answered, you can't. The list view web part get data from Server and JSLink a technique to render the data. JSLink itself doesn't process any of the data. It renders the data the way you want.

As a workaround, I would like to suggest you to create a new view, place the conditions you want to check as view filter and use this view in List View Web Part and apply the CSR/JSLink. This way your paging wont break.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.