We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Calling a method collapseAtLevel not work

Hi

I have this fragment of code in vue component...


<ejs-treegrid
      :allowPaging="true"
      :allowRowDragAndDrop="checked"
      :dataSource="data"
      :pageSettings="pageSettings"
      :rowDataBound="rowDataBound"
      :rowDrag="onRowDrag"
      :rowDragStart="onRowDragStart"
      :rowDragStartHelper="onRowDragStartHelper"
      :rowDrop="onRowDrop"
      :rowDropSettings="rowDropSet"
      :selectionSettings="selectionOptions"
      :toolbar="toolbarOptions"
      :treeColumnIndex="2"
      @rowSelected="showRowInfo"
      id="treegrid"
      idMapping="WORK_ID"
      parentIdMapping="PARENT_ID"
      ref="treegrid"
    >
      <e-columns>
        <e-column :commands="commands" headerText="Opciones" width="120"></e-column>
        <e-column field="WORK_ID" headerText="Id" textAlign="Right" width="80"></e-column>
        <e-column field="TITLE" headerText="Título" width="300"></e-column>
        <e-column field="TAGS" headerText="Tags" textAlign="Right" width="200"></e-column>
        <e-column field="STATUS" headerText="Estatus" width="120"></e-column>
        <e-column field="WORK_TYPE" headerText="Tipo" width="120"></e-column>
        <e-column field="REGISTERED_DATE_STR" format="yMd" headerText="Registro" textAlign="Right" width="140"></e-column>
        <e-column field="UPDATE_DATE_STR" format="yMd" headerText="Actualizado" textAlign="Right" width="140"></e-column>
        <e-column field="ELAPSED_DAYS" headerText="Días" textAlign="Right" width="80"></e-column>
      </e-columns>
    </ejs-treegrid>

...

    onChangeCboProject: function(e) {
      let project_id = this.getProjectId();
      if (project_id === -1) return;
      this.projectsGetAll(this.$endpoint_WORKS_GETALL, project_id);

     // THIS LINE NOT WORKS, 
      this.$refs.treegrid.ej2Instances.collapseAtLevel(2);
    },



I dont have any console errors, but the call to collapseAtLevel method doesnt do anything
Whats the right way to do it?

Thanks in advance




1 Reply

PK Padmavathy Kamalanathan Syncfusion Team February 6, 2020 06:47 AM UTC

Hi Jose, 

Thanks for contacting Syncfusion Forums. 

QUERY: collapseAtLevel doesn’t work 
 
From your query we understand that you are unable to use method collapseAtLevel in your application. We are unable to reproduce the issue at our end. Please check the below sample,  

Also you have mentioned that you don’t get any script error. We suspect that you may not have data with level 2, and due to that, when you call collapseAtLevel method with “2” as parameter, it does nothing. Please make sure that the data you have binded to treegrid have level 2 if you call collapseAtLevel method with “2” as parameter. 

Still facing the issue, please share us the below details, 
  1. Complete treegrid rendering code
  2. Version details
  3. If possible, reproduce the issue in the sample above and share us.

If you have further queries, please get back to us. 
 
Regards, 
Padmavathy Kamalanathan 



Loader.
Live Chat Icon For mobile
Up arrow icon