Nirmal Thawani
Nirmal Thawani

Reputation: 13

Kendo UI splitter resize event

I am using Jquery Kendo UI splitter,in which only right panel is collapsible. I want to refresh left panel, when a resize and collapse is done for the right panel. The logic for refresh is written in the resize event of the kendo splitter. But the problem is that resize events gets called even when expand/collapse is performed. Is there a way to prevent resize event in case of the expand of right panel.

Upvotes: 1

Views: 1166

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21465

The fact is that the widget calls expand or collpase events before the resize event, so you can use your own flag to handle that, as the native resize event doesn't specifies which action is being performed.

Add a variable like below in your events:

let isCollapse = false;
function callMeOnlyOnCollapse() {
    console.log("Collapse!!!!");
}

function onResize(e) {
    if (isCollapse) {
        callMeOnlyOnCollapse();
    }
}

function onExpand(e) {
  isCollapse = false;
}

function onCollapse(e) {
  isCollapse = true;
}

Demo

Upvotes: 1

Related Questions