How to avoid timers on HandleFilterReal

hello,

I'm implementing some JS script client side using script editor.

I actually implemented a simple logic to handle clicks on list web part rows and dynamically filtering on other related  web parts in the page. To accomplish this I override HandleFilterreal:

function MyHandleFilterReal (e,c,b)
{
HandleFilterReal(e,c,b);
setTimeout(SetClickHandlers, 1000);
}

and call it like this:

inplview.HandleFilterReal(myevent,myurlfilter,null);

Now, I'm placing a timer after HandleFilterReal because it is asynchronous and my click handlers wouldn't be set. I'd like to know whether is there any other way to accomplish the same task, but without timers.

Tha

September 8th, 2015 8:55am

Hi Emiliano,

Can you provide more details about your complete requirement and code? Lets see if there is any existing solution already.

Since it is an asynchronous function and the click handlers need to be set later, without using a timer, a workaround is that, we can either:

Use setInterval() to loop check if there any changes in DOM after the execution of the asynchronous function, set the click handlers, then clearInterval() to clear the timer;

Or

Instead of overriding the HandleFilterReal function, attach click event to the each rows of list view in custom function to set dynamic filters on other web parts, or display the filtered content from other web parts in a custom content area in the same page.

Thanks                 

Patrick Liang

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 4:28am

Can you provide more details about your complete requirement and code? Lets see if there is any existing solution already.

I'm searching for a javascript (client-side) way to display filtered content and partially refresh web parts (no full postback).

I traced back sharepoint js code and found it uses HandleFilterReal, which is not provided by SP JSOM (at least didn't found it).

As a final requirement I need to apply HandleFilterReal (or something which has the same functionality) and perform a custom SetClickHandlers at the end of the call (as a callback).

Tha

September 10th, 2015 2:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics