Hey guys i have another question about dojo.
This time it has to do with data stores(Memory) and a custom template.
So i have a dataStore build from Json Data and i am wondering how i can create a custom template instead of a grid to display that data.
let’s say i have the following JSON data :
var employees = [
{ id: 1, name: "Jim", department: "accounting" },
{ id: 5, name: "Bill", department: "engineering" },
{ id: 3, name: "Mike", department: "sales" },
{ id: 4, name: "John", department: "saleas" }
and i create my data store like so:
employeeStore = new Memory({ data: employees });
employeeStore = new Memory({ data: employeeStore.query({}, { sort: [{ attribute: "id"}] }) });
Now what i want to do is display that data in this template HTML:
<div data-dojo-attach-point="someNode">
<div data-dojo-attach-point="checkbox" data-dojo-type="dijit/form/CheckBox"></div>
<div data-dojo-attach-point="id"></div>
<div data-dojo-attach-point="name"></div>
<div data-dojo-attach-point="department"></div>
I want to display the data in the following way (style is not important now)
I cannot add an image so here is the resulting HTML I am looking for.
<div>
<div>1</div>
<div>Jim</div>
<div>accounting</div>
</div>
<div style="clear:both;"></div>
<div>
<div>3</div>
<div>Mike</div>
<div>sales</div>
</div>
<div style="clear:both;"></div>
<div>
<div>4</div>
<div>John</div>
<div>sales</div>
</div>
<div style="clear:both;"></div>
<div>
<div>5</div>
<div>Bill</div>
<div>engineering</div>
</div>
<div style="clear:both;"></div>
Thanks in advance for your help!
Solon
Sounds like you want to create a template-widget. While I have no advice since I haven’t used this part of the dojo toolkit, it sounds like what you need:
https://dojotoolkit.org/documentation/tutorials/1.8/templated/