How to show only milestones?


I’m trying to implement a filter for milestones, so that if the checkbox is checked it only shows milestones.

My problem is once I show milestones, I can’t go back to showing the whole gantt.

Can you please help? Thanks.

Hello @ilyasdergal,

I tried to reproduce this issue with the following code:

var toggle = false;
// Function which toggles filter and rendedrs gantt    
function toggleFilter(){
    toggle = !toggle

// Event which filters tasks based on the "toggle" value and their types           
gantt.attachEvent("onBeforeTaskDisplay", function (id, task) {
    	return true;
  	if(toggle && task.type == "milestone")
		return true

but it worked correctly, here is a demo(HTML/CODE tabs):

The issue can be connected with your filtering logic or some custom functionality. Unfortunately, I can’t say what is going wrong without details.

If the demo above doesn’t help and you still have some issue - could you please reproduce it in the demo above(reproduce => click the “Share” button => send me the new link).

btw, did you watch the following guide:

it could be helpful to understand the basic principles of filtering in gantt.