Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -
Accepted Solution

Issues in using jquery with Webworks

Hello,

 

Im developing an application for blackberry 10. In this application i have to dynamically create items for an image list (those are added by pressing a button). Just to give you an idea:

<div data-bb-type="image-list" data-bb-images="none" id="data-goes-here">

     <!-- my application has several items with different descriptions, title... ->
     <div data-bb-type="item" data-bb-title="my title" data-bb-img="img.jpg">Description here</div>

     <div data-bb-type="item" data-bb-title="my title" data-bb-img="img.jpg">Description here</div>
</div>

 

In order to create the items, i found an userfull function in webworks samples, which is basically creating the div element by using native javascript, and this works:

 

function createItemElement(title, description, img) {
var item = document.createElement('div');
item.setAttribute('data-bb-type','item');
if (title) {
item.setAttribute('data-bb-title',title);
}
if (description) {
item.innerHTML = description;
}
if (img) {
item.setAttribute('data-bb-img',img);
}
return item;
}

 

However, i was trying to use jquery to create an item, and that bascally it didn't work because jquery created the item properly, but the custom bb classes which are usually added automatically this time weren't added. So i had a simple div with right attributes appended to the list, but it didn't recieved the ".bb-bb10-image-list-item-light" and other classes and it looked a bit ugly.

 

Do i have to call some particular method to refresh the graphics of the div ?

 

Thank you for your answers!

Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: Issues in using jquery with Webworks

Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -

Re: Issues in using jquery with Webworks

So it looks like there are no refresh() function... However, thank you much for your reply!

Highlighted
Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: Issues in using jquery with Webworks

no.. there is a refresh function for imageList! read the docs

Nuno
Contributor
Posts: 13
Registered: ‎01-21-2013
My Device: BB 10
My Carrier: -

Re: Issues in using jquery with Webworks

Oh, sorry didn't noticed that! 

 

Thank you very much, that's gonna be very userful!