locked
Sharepoint 2013: How can I use custom filter in XsltListViewWebPart if client site rendering ? RRS feed

  • Question

  • I wish text box on SitePage where I can input filter value  and XsltListViewWebPart will show items corresponding of my input filter.

    If server rendering I have Filter button in SPD and create parameter that bind my TextBox to Filter.

    But how to must I doing if client side rendering (CSR) ? I haven't Filter button in SPD...    

    Thursday, March 21, 2013 5:26 AM

Answers

  • So, I resolved it :)

    1) SPD2013 will show "Parameters" and "Filter" buttons for web part, if you click web part properties, change something and save it in SPD2013. After this dumb operation SPD2013 will show additional context menu for web part that include "Parameters" and "Filter" buttons. Don't ask me why  :)

    2) All filter work for list - server side, same as in SharePoint 2010. You may add parameter to web part and link filter with this parameter.

    3) Client side rendering will work with ready filtered data only. If you need update filter ->  __doPostBack (POST request)  and server side will back new filtered scope.    AJAX properties may be used to avoid all page redrawing.

    4) Yes, you may have additional filter on client side by override onPreRender and simply delete some records from ListData.Row but:

    - it will not affected by header XSLTListView filters

    - data page portions will be working incorrect

    - grout data will be incorrect too

    5) The worst thing it is, even I wish use client side filter in onPreRender I haven't found way how to re-render list without postback request to server. It is mean I can't apply new filter without new request to server :( Even I keep all list data as JSON on page. Of cause I can realize it with my own custom gridview but it will need  more effort and will be not so powerfull as use XSLTListWebPart...  


    • Edited by varvar_p Friday, March 22, 2013 10:09 AM
    • Marked as answer by Emir Liu Friday, March 29, 2013 3:30 AM
    Friday, March 22, 2013 10:02 AM

All replies

  • Hi,

    You shall have a look at this blog post which describes how to filter a DVWP based on a value from a Text Filter web part.


    Regards,
    SC Vinod
    Blog
    : http://sharesilver.wordpress.com/

    Thursday, March 21, 2013 10:41 AM
  • Thank you very much for your reply. It is really nice blog post. But for SPD2013 when you use client side rendering don't show  "parameters" window and don't show "Filter window".

    So, for CSR will be grate idea make filter on client side, because all list data already keep on client after page loaded as JSON array. The client side filter can work extremely fast (immediately!) without request to host...  But what is Microsoft way to make CSR filter I can't find any information :(   

    Thursday, March 21, 2013 11:16 AM
  • So, I resolved it :)

    1) SPD2013 will show "Parameters" and "Filter" buttons for web part, if you click web part properties, change something and save it in SPD2013. After this dumb operation SPD2013 will show additional context menu for web part that include "Parameters" and "Filter" buttons. Don't ask me why  :)

    2) All filter work for list - server side, same as in SharePoint 2010. You may add parameter to web part and link filter with this parameter.

    3) Client side rendering will work with ready filtered data only. If you need update filter ->  __doPostBack (POST request)  and server side will back new filtered scope.    AJAX properties may be used to avoid all page redrawing.

    4) Yes, you may have additional filter on client side by override onPreRender and simply delete some records from ListData.Row but:

    - it will not affected by header XSLTListView filters

    - data page portions will be working incorrect

    - grout data will be incorrect too

    5) The worst thing it is, even I wish use client side filter in onPreRender I haven't found way how to re-render list without postback request to server. It is mean I can't apply new filter without new request to server :( Even I keep all list data as JSON on page. Of cause I can realize it with my own custom gridview but it will need  more effort and will be not so powerfull as use XSLTListWebPart...  


    • Edited by varvar_p Friday, March 22, 2013 10:09 AM
    • Marked as answer by Emir Liu Friday, March 29, 2013 3:30 AM
    Friday, March 22, 2013 10:02 AM
  • i don't understand how did you achieve filtering with client side rendering, especially the "__doPostBack (POST request)" part.

    I have to set the web parts to server render to achieve filtering with web part connection.

    After setup web part connection, we may notice the added "select" icon, after selecting the icon, there will be a POST to server, and you can see that the url in address bar has a querystring parameter indicating your current selection. The behavior is the same no matter you select server rendering for web parts or not. And i had checked the onclick event js for the icon, its same no matter web parts is server rendering or not.

    However, for client side rendering, the filtering just don't work, it works for client side rendering. So, i guess this is just some problem with client side rendering.

    Since my child list is an task list, client side render provider additional feature such as indenting. I wonder whether i can customize the client side render view to achieve filtering.

    one solution may be modify the onclick event for the select icon, another may be refresh the child list view based on the querystring parameter SelectedID

    Wednesday, November 5, 2014 7:58 AM
  • it looks like filtering does not work corrected. the following picture show web parts in client side rendering, i can see that selected value is correctly passed into the column header filter for child view. But the child view just does not display correctly:

    Wednesday, November 5, 2014 8:26 AM
  • So is it true that if you are using Client Side Rendering, you can't use parts of the Server Rendering - parameters, web part connections?

    I have a Text Filter web part and an XsltListViewWebPart on the same page, text in TF sent to parameter in XLVWP which sends to Finder methods, which sends to list operation in External Content Type / List, and it all works fine in Server Render.

    When I then want to round off the display with some Client Side Rendering, I clear the Server Render in the web part properties, then my JSLink works fine, but I lose all the TF to XLVWP to ECT/L functionality.

    Please say it ain't so?

    Or at least please could Microsoft confirm or deny whether you can use CSR with SR?


    • Edited by Bellerophon Friday, December 18, 2015 12:04 PM
    Friday, December 18, 2015 12:03 PM