需求:
用时间区间(开始时间,结束时间)来筛选类表。
效果:
注意目标操作如下

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

最后实现效果如下

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

具体实现步骤:

Setting up multiple date filters to filter a list by a date range is possible out of the box in SharePoint 2010.

Using date filter web parts to send values to a lists parameters we can get the list to filter by a date range.

Setting this up is rather simple...

In your browser create a new page and add your populated list to it via the web parts options on the ribbons. For this example I'm just going to use my tasks list.

On the same page add a date filter webpart

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

 

From the arrow drop down that appears when you hover over the new date filter web part, select edit web part.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

In the options pane that appears, change the Filter name to 'Start Date', and change the default value to 'offset from today : 30 days : Before today'. Then click ok.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Underneath that, add another date filter and change its filter name to 'End date', and change the default value to 'offset from today : 0 days : After today'. Then click ok.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Now save the page in your browser, then open the page up in SharePoint designer (SPD) - in design view.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Once opened in SPD, click on the list web part to select it, then in the ribbon click on the list view tools > options > parameters icon.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Add two new parameters, one called 'startdate' and another called 'enddate. Leave the parameter sources and default values as default and click ok when done.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

The parameters on the list allow us a point for our date filters to pass their values to. Now we need to set up the connections between the list and the date filters.

Right click on the start date filter and click add connection. In the dialog that pops up change the dropdown value to 'Send filter values to', click next.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Ensure that 'connect to a web part on this page' is selected in the next dialog and click next.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Change the target action in the next dialog to 'Get parameters from' and click next.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

In the next dialog, select 'Start Date' from the first box, and 'Startdate' from the second box and click next. Then click finish.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Go through the same process with the second date filter, but in the final step select 'End date' and 'Enddate' from the boxes.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Now we have our date filters feeding the list with its values but we still have to set up the filter on the list.

Click the list web part to select it, then in the ribbon click on the list view tools > options > filters icon.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

The filter criteria box will popup. First add a rule 'Created > Greater than or equal to > [Start date]'.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Then add another clause 'Created > Less than or equal to > [Enddate]'. Click ok.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

Now save the page and open it back up in your browser.

It will, by default, show all tasks created in the last seven days thanks to the default setting of the start date filter. Changing these filter will filter the list according to the date ranges set.

SharePoint 2010 列表日期区间筛选 -- 金大昊(jindahao)

 

引用自:https://www.nothingbutsharepoint.com/sites/eusp/Pages/SharePoint-List-filtering-by-date-range.aspx

 

 

 

 

努力过就不会后悔

 

相关文章:

  • 2021-12-29
  • 2021-11-17
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2021-11-02
  • 2022-01-02
  • 2022-12-23
  • 2021-08-11
  • 2021-07-06
相关资源
相似解决方案