0

I have used one user control in SharePoint master page which will automatically refresh on every five seconds ( I have used asp Update Panel and asp timer control for doing this)

And I have one SharePoint list view in which I have used JSLink for for changing color of row based on some business logic

So my problem is when asp time control do partial post back to server at that time SharePoint listview also gets updated.

Any suggestions?

1 Answer 1

0

You must literally tell SharePoint to reexecute your JSLink on partial postbacks.

The following instructions are for MDS (Minimal Download Strategy) enabled site, but I think your scenario is in essence the same:

First, you need to change the anonymous entry point function to a function with an entry point signature. Then, you need to call RegisterModuleInit() function to register an override of this code on MDS enabled sites.

RegisterModuleInit("CSRAssets/CSRFieldType.js", RegisterFavoriteColor);

Source

where CSRAssets/CSRFieldType.js is the path to your javascript in the layouts folder (you can use /A/path.js as well for files in document library), and RegisterFavoriteColor is the name of your function to execute.

If you use namespaced (modules) for your JS functions, you must use the

Type.registerNamespace('Fishbone')

to make the above work.

Full example, for content inside a JSLink .js-file:

Type.registerNamespace('Fishbone');

Fishbone.MakeSomeMagic = function(){
    alert('Hello from Malmo');
}

RegisterModuleInit("Fishbone/SampleJSLink.js", Fishbone.MakeSomeMagic);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.