开发者

Refresh Sitecore after changing icon of Item

开发者 https://www.devze.com 2023-04-04 06:34 出处:网络
I hooked up an extra eventhandler to the Sitecore onItemSaved actions to change the icon of an item in Sitecore. The icon gets changed, but you have to refresh the Sitecore content tree to see that it

I hooked up an extra eventhandler to the Sitecore onItemSaved actions to change the icon of an item in Sitecore. The icon gets changed, but you have to refresh the Sitecore content tree to see that it has changed. Is it possible to programatically make sure the changed icon gets visible to the user instantly in the content tree?

I used:

item.Field["__icon"].Value = "someicon.pgn"

with a Editing.BegintEdit() and a EventDisabler around it.

When you change the Icon of an item in Sitecore itself, the icon gets visible instantly, this is what I would like to see aswell.

Any suggest开发者_StackOverflowions?

Thanks!


To refresh the content tree from the code use:

//TODO: set to the appropriate item 
String refresh = String.Format("item:refreshchildren(id={0})", currentItem.Parent.ID);
Sitecore.Context.ClientPage.SendMessage(this, refresh);


Remove the EventDisabler, that's likely the issue... It also disables client events...

0

精彩评论

暂无评论...
验证码 换一张
取 消