Hi again, so after playing with it some more, I learned a bit more about getting the json_encode over to ExtJS.
That said, I have the following JSON that is coming in from json_object.php:
Code:
[{"id":"84","name":"Communities","type":"label","label":"Communities","rank":"1","label_css_class":"lbl_regular","css_class":"","searchable":"t","node_type":null,"node_rank":null,"value":"2"},{"id":"85","name":"Community1","type":"checkbox","label":"Community1","rank":"2","label_css_class":"lbl_checkbox","css_class":"","searchable":"t","node_type":null,"node_rank":null,"value":"2"},{"id":"86","name":"Community2","type":"checkbox","label":"Community2","rank":"3","label_css_class":"lbl_checkbox","css_class":"","searchable":"t","node_type":null,"node_rank":null,"value":"2"},{"id":"87","name":"Community3","type":"checkbox","label":"Community3","rank":"4","label_css_class":"lbl_checkbox","css_class":"","searchable":"t","node_type":null,"node_rank":null,"value":"2"},{"id":"88","name":"Comments","type":"text","label":"Comments","rank":"5","label_css_class":"lbl_regular","css_class":"form_text_area","searchable":"t","node_type":null,"node_rank":null,"value":"3"},{"id":"89","name":"Some Other Field","type":"other","label":"Some Other Field","rank":"6","label_css_class":"lbl_regular","css_class":"","searchable":"t","node_type":null,"node_rank":null,"value":null}]
That said, I want to use that data to build my form. Basically, I want to parse it. If I see a checkbox, that goes in a specific form element.
So my first task is to use the data with Ext. So I make a JsonStore, right? Like so:
Code:
var dataStore = new Ext.data.JsonStore
({
url:'json_object.php',
idProperty: 'id',
fields: [
{name: 'id'},
{name: 'name'},
{name: 'type'},
{name: 'label'},
{name: 'rank'},
{name: 'label_css_class'},
{name: 'css_class'},
{name: 'searchable'},
{name: 'node_type'},
{name: 'node_rank'},
{name: 'value'}
]
});
dataStore.load();
Now, how can I make sure I am even storing the data right? I mean, I barely know what the JsonStore is for. I'm hoping it's just a place I can store that json_encoded object to parse and use when I need to.
Because in the end, I want to parse that, find all the checkboxes, and put them in to this:
Code:
var Group_Checker =
{
xtype:'fieldset',
title: 'Group Check',
collapsible: true,
autoHeight:true,
itemCls:'x-check-group-alt',
columns: 1,
store: dataStore,
items: [{
html: '<p class="bodyText">From the list below, select the groups ' +
'that you would like to allow to see this submission.</p>',
}, //checkbox_items
]
};
Can anyone give me some suggestions to prod me in the right direction to accomplish this, because I'm drowning in code here that I'm hardly understanding, and I don't quite know if I'm doing this properly, or *how* to do it.
Thanks!
Kevin