Recently in the entire SP list
The boss needs to use the list to standardize the weekly report format.
It is suggested to view the contents of last Monday to Sunday in a view.
I thought of the following methods after turning over the materials
1. Add the time filter webpart on the view page and input parameters to filter the list.
2. Add a button in the list and use textbox to query the list of parameters passed in by querying the string write segment JS
3. Directly determine by Field Value
The first implementation method:
Second Implementation Effect
The first implementation method:
Open SharePoint designer and insert two date Filters
Click the Filter button and select a condition in the pop-up box.
Stime is the new parameter, as shown in figure
The above design has been completed in the design. We return to the page and need to perform Operation settings on the page to edit the page.
Select the webpart of a time filter and click Connect.
Select the sending location of the filter value, select the location for obtaining the parameter, and click Configure
In the Configure connection, select the parameter field and click Finish.
The above is the first method to implement time filtering. You can set the default value for the webpart time filter, but it still cannot meet the requirements, so proceed to the second method.
The second method is basically the same as the first one. You need to write code...
Still open desiger
Put two textbooks and buttons ..
Click filter again
Note that the startdate of the domain name is the column name, And the startdate below the value is the parameter.
After the setting is complete, it is the turn of the button to take effect.
<script type="text/javascript">function change() { var s=document.getElementById("txt1").value; var e=document.getElementById("txt2").value; alert(s+e); window.location.href="1.aspx?StartDate="+s+"&EndDate="+e; }</script>
Please ignore this very boring js code...
You can add restrictions or beautify on your own ..
Then return to the page. You can achieve time filtering. But! Still unable to meet the demand.
It seems that you have to try again.
This time I decided to use the field value for determination.
I found a function weekday () in Excel ()
I tried to use this function weekday (today (), 2) in the calculation bar of the List Value)
This means to get the current date in the day of the week
Today is July 22, September 24, 2014, so the value of this function is 3.
I checked the information online and found another function datedif ()
Datedif (startdate, today (), "D ")
The above indicates the interval between startdate and today.
Now I have two functions.
If I use the interval date, can I determine the last week or even the last week?
Less than 0 is this week
The period between 0 and 7 (excluding 7) is last week.
More than 7 is the last week...
The last three columns are respectively the interval Day, the nth Day, and the subtraction result.
Finally, I modify the filter conditions of the view.
The results are filtered out...
I think too much about it ..
SharePoint filter by Time