zoukankan      html  css  js  c++  java
  • WSS 3 / MOSS Creating Views in CAML (List Definition)

    I have been creating custom Lists in CAML for deployment by features.  As you do.  I found out a few things that might be of help when you are creating them yourselves.

    I am  Assuming that you now how to create a list template and know what goes in a schema.xml to a point.

    Concentrating solely on views here I found out this.

    If you have a List View WebPArt you need one of these types of views, if you don’t LVWP don’t work.

    <View BaseViewID="0" Type="HTML">….</View>

    Careful of BaseViewIDs being the same.

    <View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary" Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
                ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

    <View SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary"  Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
                ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

    Notice that the BaseViewID’s, that wonderful field that’s barely documented, if they are both the same number then you might get problems.  I can’t explain why, but In my views I created the second view had a different Query but was ignored when created and it copied the first views query.  When I changed the BaseViewID=2 on the second view everything worked.

    Is that the right thing to do ? I can’t say I’m only commenting on what I have observed.

    Don’t do this

    <View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary" Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
                ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

    <View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary"  Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
                ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

    If you forget when you cut and paste if you have two default views in the "Lists" page it shows up twice, its not really there twice but looks like it is.  You may not notice till too late with this one.

    References:http://www.binaryjam.com/2008/11/06/wss-3-moss-creating-views-in-caml-list-definition/

  • 相关阅读:
    转载~基于比较的排序算法的最优下界为什么是O(nlogn)
    关于 cgdb & gdbtui 的输入scanf()问题
    制定ip池内随机生成ip地址
    C 随机不重复元素~转
    随机选取算法 (有权重的记录中选取)~转
    全局变量的教训
    Python字符串的encode与decode研究心得——解决乱码问题
    Python 求最大公因式~辗转相除法
    Python格式化字符串~转
    Python 中的枚举类型~转
  • 原文地址:https://www.cnblogs.com/KingStar/p/1891762.html
Copyright © 2011-2022 走看看