Can DetailList component do this?

Iron Contributor

Hi,

 

Does the DetailList component filter by columns? 

I mean if I have a date column I would like to filter the columns which date has passed. 

The filter tool in the DetailList is more like a search tool which is not enough to make this kind of filtering.

 

Best regards

Americo

4 Replies

@Americo Perez The filter works as you would expect, it just takes the current result set and filters the 'name' column by the filter text. You could build your own date control if you want (or a drop down populated by the data in the list) and do similar filtering.

Is there anything that I can try and clarify to help?

Thanls @Beau Cameron for the clarification. 

I am afraid that the filter functionallity OOB is not what I am looking for. 

In my web part I have a group of buttons, some of them re render the DetailList and show the results in groups, and some other buttons should filter the list when they get clicked. I have created the list's views to see how it should work, now I am stuck in getting the same funciontalliy in the Detailist. 

In the list it is a column that shows agreements end dates and I have a listview that show only the rows which it date is older than today.

In the detailList filter I can't find the way to do that type of filtering, 

I don't even find the way to conect the button's click event to the DetailList in order to filter the list.

 

Best regards,

Americo

@Americo Perez Maybe I'm not fully understanding, but you have a lot of control in how your data is filtered. That details list is just a rendering of your items. Your button isn't directly connected to your DetailList. Your DetailList should be getting the items from the state of your component.  Your button that is doing some filtering, should have the click event, which would subsequently filter/sort/change the state object for your items.

Your event could filter the *current* list of items in your state, or you could make a new call to SP to get a new list of items.  Either way, you just need to set your state based on that criteria. If in your case, you want to filter by today's date... you'd write the JS to filter out the current list and set the state, or make a call to SharePoint to get new items filtered by the date.

You can create one more column and it should be hide for users. and use calculated value in that column where date has passed. Next use the same column as filter.