LIstview - commandBarProps - Add New button

Copper Contributor

Hello

 

I want to call a javascript which is available in site asset library. For this I want to add one button on list view commandBarProps and on clicking on new button, javascript should execute.

 

I found one script, which will export search filtered data to excel. I found this Export Only SharePoint Filtered List Items To Excel.

 

Is this possible to call javascript from commandBarProps - New button?

Is there way add button or image on top of list view, where above script can be called?

Is this possible edit allitems.aspx page?

 

I ready various article, and noticed this can be possible thru SPFx as well, but I am not good in SPFx.

 

Can someone suggest to export search filtered result to excel / CSV?

 

Please remember we have to implement on Modern Pages not Classic Page, secondly contend editor also  not available to us as part of company policy.

 

Avian

3 Replies

@Avi65 This is not possible using SharePoint JSON formatting commandBarProps.

 

You have to develop a custom SPFx list view command set for adding button in list command bar and calling JavaScript code using it.

 

Check this documentation to get started with: Build your first ListView Command Set extension 

 

Also, check the SPFx extension samples given here which might help you: SPFx extensions samples 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

Hello

I already knows this, I am new to SPFx.

Is there any way to edit allitems.aspx for modern pages, So I can add my custom app?

@Avi65 No, you cannot edit allitems.aspx page in SharePoint online modern experience.

 

Only way supported and recommended by Microsoft for your requirements to add a button in list command bar is to use the SPFx list view command set.


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs