Programatically changing field order in Sharepoint 2007 list

后端 未结 3 1307
北恋
北恋 2021-01-27 03:07

I\'m adding in two new fields into an already existing Sharepoint list programmatically through a feature. The fields are being added successfully but I have been unable to adju

3条回答
  •  长发绾君心
    2021-01-27 03:36

    I took a look at the source of the Column ordering page (formEdt.aspx), it looks like they use web services, not the object model:

    function DoBuildAndSubmit()
    {
        var numFound, currentSelect, selectValue;
        var form = document.forms.aspnetForm;
        var numFields = form["numSelects"].value;
        var xml = "";
        numFound = 0;
        while(numFound < numFields)
        {
            for(x = 0; x < numFields; x++)
            {
                currentSelect = form["FormPosition" + x];
                if(currentSelect.selectedIndex == numFound)
                {
                    selectValue = currentSelect.options[numFound].value;
                    xml = xml + "" + "\n";
                    numFound++;
                }
            }
        }
        for(x = numFields ; x < 67; x++)
            xml  = xml + ""  + "\n";
        xml = xml + "";
        document.frmLayoutSubmit["ReorderedFields"].value=xml;
        document.frmLayoutSubmit.action = "http://local/_vti_bin/owssvr.dll?CS=65001";
        document.frmLayoutSubmit.submit();
    }
    

    Now, it might be possible to do through the object model, but I don't have a good feeling about it when the UI is punting.

提交回复
热议问题