0
<script type="text/javascript">
function retrieveFieldsOfListView(){
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var list = web.get_lists().getByTitle('pranav_list');
var view = list.get_views().getByTitle('Main');
this.listFields = view.get_viewFields();
clientContext.load(this.listFields);
clientContext.executeQueryAsync(Function.createDelegate(this,
this.onListFieldsQuerySucceeded9), Function.createDelegate(this,
this.onListFieldsQueryFailed));
}
function onListFieldsQuerySucceeded9() {
var fieldsinfo='';
var fieldEnumerator = listFields.getEnumerator();
while (fieldEnumerator.moveNext()) {
var oField = fieldEnumerator.get_current();
var fType = oField.get_fieldTypeKind();
fieldsinfo +='\n '+oField.get_title();
}
alert(fieldsinfo);
}
</script>
我想使用javascript顯示視圖的字段。使用Javascript檢索Sharepoint列表的字段/列名
注意:我的列表名稱是「pranav_list」,並且視圖是「Main」。
幫助..!
如何獲取查看的所有項目? – 2015-02-27 11:49:24
Ok..done.http://stackoverflow.com/questions/28764636/retrieve-items-from-a-list-view-of-a-sharepoint-list-using-javascript – 2015-02-27 11:59:52