Hey guys. I am creating a component for a javascript graphics library called flot.
<cc:interface>
<cc:attribute name="data" required="true" />
</cc:interface>
<cc:implementation>
<div id="placeholder" style="width:600px;height:300px;"></div>
<script type="text/javascript">
//<![CDATA[
$(function () {
var d1 = [#{cc.attrs.data}];
$.plot($("#placeholder"), [ d1 ]);
});
//]]>
</script>
</cc:implementation>
This is a small amount of code that I still have. My problem is how can I make this div tag randomly generated on the page so that I can output multiple diagrams. Obviously, this will not be done in the current state. I need to pass a value to a javascript function.
I know that I can simply create another attribute with the required identifier, and the user will need to specify the identifier, but I noticed that on many components an identifier is not required. It seems like in heavy ajax / javascript libraries like right and icy surfaces that the ides are random, somehow.
.