FlexLayout icon indicating copy to clipboard operation
FlexLayout copied to clipboard

I Can select a tab which in a tabset (programmatically) but can't select a tab which in a border (programmatically)

Open spider58 opened this issue 4 years ago • 4 comments

Hi, i have a left border which has 2 tabs inside it and name is myLeftBorder

i want to select second tab programmatically, i tried below code,

    myModel._borders._borders[0]._attributes.selected = 1   // default selected tab is 0.

and also i tried to below code

      myModel.doAction(Action.setActiveTabset("myLeftBorder"))
      myModel.doAction(Action.selectTab("mySecondTab")

and also i tried to below code

      myModel.getBorderSet().getBorders()[0]._setSelected(1)

both of codes doesn't worked.

i can see selected as 1 with below code, i think there is a refresh problem

      myModel.getBorderSet().getBorders()[0].getSelected() 

What can i do for solve my problem.

Thanks inadvance.

spider58 avatar Jul 03 '20 14:07 spider58

ok. i found a refresh solution (I searched inside the model proto)

below code works well

      myModel.getBorderSet().getBorders()[0]._setSelected(1)
      myModel.doAction(Actions.Actions.updateModelAttributes(JSON.stringify(myModel.toJSON())))

spider58 avatar Jul 03 '20 14:07 spider58

you can use myModel.doAction(Action.selectTab(idOfSecondTab)) where your second tab has id: idOfSecondTab (it's the id not the name of the tab)

nealus avatar Jul 03 '20 17:07 nealus

you can use myModel.doAction(Action.selectTab(idOfSecondTab)) where your second tab has id: idOfSecondTab (it's the id not the name of the tab)

i already tried below code but doesn't worked on Border, but working on Tabset well

      myModel.doAction(Action.selectTab("mySecondTab")

my sample code which at above answer working well.

spider58 avatar Jul 06 '20 14:07 spider58

how can i select a tab in a tabset programmatically?

AreebAfzal avatar Aug 16 '23 11:08 AreebAfzal