bbc / tal

TV Application Layer

Home Page:http://bbc.github.com/tal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to implement 2 Carousels in same component?

Himanshu-Gurung opened this issue · comments

Greetings to all,

Please let me know if I can implement 2 Carousels in the same component.
http://bbc.github.io/tal/widgets/carousel.html

Thanks In Advance,
Himanshu Gurung

Yes you can create n number of carousels in a component. Carousel id should be different in this case.

Greetings @Arunprasanth,

I have a requirement for my client. A component with two carousels, one to show movie categories and another to show movie listings of selected movie category. This will be on the same component and on the basis of selected movie category, the below carousel of movie listings will refresh kind of ajax load of movie listings section.

Earlier I was using two different components for this.

Thanks In Advance,
Himanshu

If you have only 2 carousel components then you do new Carousel(...) with two different ids .I think your second carousel will be shown based on the movie category selection then you can create a select event on the first carousel and in that function add the code to create second carousel and append it to a vertical list.

Ok @Arunprasanth, I will try to open second carousel on the basis of select.

I have query regarding keyboard, is there any way to close the keyboard after appendChildWidget.

Thank you,
Himanshu

@Himanshu-Gurung You can use hide() method in the widget .
Please refer this for getting more idea widgets/widget.js, line 293

@Arunprasanth, yes I did that not working.

Can you please update your talkeyboard repository with this. Please make it on any character for example:'='.

Please review my code:-
keys =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0','.','SPACE','-','=','_','!','@','.co.uk','.com'];
keyboard = new Keyboard("Keyboard",23,2,keys,true,true);
keyboard.setActiveChildKey('A');
keyboard.addEventListener("select", function (ev) {
self.UserValue.setText(keyboard._currentText);
console.log("Keyboard : "+keyboard._currentText);
var myString = keyboard._currentText;
var lastChar = myString[myString.length -1];
console.log("Last Char :"+lastChar);
if(lastChar == '='){
myString = myString.slice(0, -1);
console.log("String :"+myString);
self.UserValue.setText(myString);
this.hideElement(keyboard);
}
});
this.appendChildWidget(keyboard);

use this.getChildWidgets()[your widget number].hide();
If you wan to hide 0 th widget then add 0 , if you want to hide 1st element then add 1 so on ..
I haven't tried but i think widgetname.hide() will also work.

Thank you @Arunprasanth for your quick response, but I did the following two:
1- keyboard.hide();
2- this.getChildWidgets(keyboard).hide();

Both not working, am I doing something wrong.

Please, it will be helpful if you update the talkeyboard repository.

@Himanshu-Gurung 2- this.getChildWidgets(0).hide(); try this. I am not sure your childwidgets so based on whoch widget you have to hide you can give its number

We have deprecated this project and there are no plans for active development going forward.

Please see the deprecation notice.