How to create Sorting/filtering for Content Search Web Part in SharePoint Online?

I have used Content Search Web Part for one of the my Application. Using Display template, I have created a tabular format with the help of div and css. HTML Structure is like this:

<div class="rTable">
    <div class="rTableRow">
        <div class="rTableHead">
            Heading 1
        </div>
    </div>
    <div class="rTableRow">
        <div class="rTableHead">
            Heading 2
        </div>
    </div>
    <div class="rTableRow">
        <div class="rTableCell">
            Cell 1
        </div>
    </div>
    <div class="rTableRow">
        <div class="rTableCell">
            Cell 2
        </div>
    </div>
</div>

Now, I want to use Sorting & filtering in this Content Search Web Part (Or I can say, need to implement sorting for this HTML structure). Is there any possible way to achieve this?

Answers


Instead of using div structure, use Table structure. With table structure, it would be much easier to implement any kind of functionality like sorting, filtering, paging etc.

If transformation to table structure doesn't require too much efforts for your existing scenario, then i will recommended to change your HTML structure.

With table, you can use DataTable and it will fulfill your requirement.


Need Your Help

Gerrit email notification for push to master branch

git gerrit

Hello I am trying to setup email notifications for push to gerrit .

Is Amazon DynamoDB slower than Amazon RDS (php)?

php mysql amazon-ec2 amazon-rds amazon-dynamodb

We use a bunch of AWS services hosted in the Singapore region. We have a few EC2 instances and an RDS instance. We were planning to migrate some of our data to Amazon DynamoDB, which will help in our