[英]Adjust static value into dynamic (javascript) value possible in Sharepoint allitems.aspx page?
<SharePoint:SPDataSource runat="server" IncludeHidden="true" SelectCommand="<View><Query><OrderBy><FieldRef Name="EventDate"/></OrderBy><Where><Contains><FieldRef Name="lawyer_x0020_1"/><Value Type="Note">F. Sanches</Value></Contains></Where></Query></View>" id="datasource1" DataSourceMode="List" UseInternalName="true"><InsertParameters><asp:Parameter DefaultValue="{ANUMBER}" Name="ListID"></asp:Parameter>
SharePoint WSS 3.0 SharePoint WSS 3.0
This codeline is just one line of the allitems.aspx of a sharepoint list item (SharePoint created it himself). 该代码行只是共享点列表项的allitems.aspx的一行(SharePoint自己创建了它)。 It only displays items where lawyer 1 = F. Sanches. 它仅显示律师1 = F. Sanches的项目。 Before I start messing around with the .ASPX page I wonder if it possible to change F. Sanches (in the code) into a dynamical variable (from a javascript value or something else that can be used to place the javascript value in there dynamically). 在开始弄乱.ASPX页面之前,我想知道是否有可能将F.Sanches(在代码中)更改为动态变量(从javascript值或可用于将javascript值动态放置在其中的其他内容) 。 If I put any javascript code in the line it will not work. 如果我将任何javascript代码放在行中,它将无法正常工作。
PS Ignore ANUMBER part in code. PS忽略代码中的ANUMBER部分。
Let say to make it simple I have javascript variable like this (now static but with my other code it is dynamic). 为了简单起见,我有一个像这样的javascript变量(现在是静态的,但在我的其他代码中是动态的)。 It would be an achievement if it would place a static javascript variable. 如果放置一个静态javascript变量,那将是一项成就。
<SCRIPT type=text/javascript>javaVAR = "P. Janssen";</script>
Eventually I would like to filter with OR operator 最终我想用OR运算符进行过滤
If Yes --> how? 如果是->怎么样?
If No --> Thank you! 如果没有->谢谢!
The easiest way to add a filter to a standard list view is to use query string filters - add 向标准列表视图添加过滤器的最简单方法是使用查询字符串过滤器-添加
?FilterField1=Lawyer&FilterValue1=F. Sanches
to the url. 到网址。 If you are working with a note field, it probably won't work directly, but you may find it easier to set up a field that does work than to make the server side chages you would need to modify the query directly. 如果您使用的是note字段,则可能无法直接使用它,但是您可能会发现,设置一个有效的字段比使服务器端需要直接修改查询要容易得多。
Another approach that might work would be adding filter web parts to the page - I haven't worked with those much myself, but in theory they should be able to do what you want. 另一种可行的方法是在页面上添加过滤器Web部件-我本人并没有那么多工作,但从理论上讲,它们应该能够执行您想要的操作。
I don't think JavaScript will work since JavaScript is client side and SPDataSource is server side. 我认为JavaScript不能工作,因为JavaScript是客户端,而SPDataSource是服务器端。
However, you should be able to use a control via ControlParameter . 但是,您应该能够通过ControlParameter使用控件。 There are good examples here and here . 这里和这里都有很好的例子。 Once the parameters are working, OR operators will definitely be supported within the CAML of the SelectCommand . 一旦参数生效, SelectCommand的CAML中肯定会支持OR运算符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.