SPFx how to identify type of list's view?

Iron Contributor

Hi,

 

I am working in a code that fetch the custom views created in a list. 

The code looks like this: 

public async getView(): Promise<IViews[]> {
let viewsList: IViews[] = [];
const itemsViews = await sp.web.lists.getByTitle("Avtal Demo").views.get();
itemsViews.forEach(item => {
viewsList.push({
Title: item.Title,
Id: item.Id
});
});

console.log(itemsViews);

return new Promise<IViews[]>(async resolve => {
resolve(viewsList);
});
}

The console log print out all information about the view. 

What I need to do is find the way to differentiate  a view that is a grouped view from one that is filtered view.

 

Is that possible? 

 

Best regards

Americo

0 Replies