Joined Tables demo confusion
Joined Tables demo confusion
I am trying to implement the joined table functionality of the Editor (commercial license) and am fairly confused over how to move forward.
Consider the following snippet (from the syntax-colored code in http://editor.datatables.net/release/DataTables/extras/Editor/examples/join.html ):
[code]
// Use the 'name' property from the 'dept' object in the
// JSON. It might not be set, so we also provide a default.
"mData": "dept.name",
"sDefaultContent": ""
[/code]
---------
Using [code]"sAjaxSource": "php/join.php"[/code] I figured out the absolute URI to get the AJAX source data is:
http://editor.datatables.net/release/DataTables/extras/Editor/examples/php/join.php
(It would be nice if I didn't have to do this -- see previous post today, "Documentation hopes". Maybe I'm missing something though.)
The actual contents of the 'dept' object are as follows:
[code]
"dept":[
{
"value":"1",
"0":"1",
"label":"IT",
"1":"IT"
},
{
"value":"2",
"0":"2",
"label":"Sales",
"1":"Sales"
},
// **** trimmed for brevity... ****
{
"value":"7",
"0":"7",
"label":"Support",
"1":"Support"
}
]
[/code]
I don't get it. Where is the 'name' property?
Where is the 'id' property mentioned in the following code:
[code]
{
"label": "Department:",
// The 'id' value from the property is used to set the value
// of the select list.
"name": "dept.id",
"type": "select"
}
[/code]
Consider the following snippet (from the syntax-colored code in http://editor.datatables.net/release/DataTables/extras/Editor/examples/join.html ):
[code]
// Use the 'name' property from the 'dept' object in the
// JSON. It might not be set, so we also provide a default.
"mData": "dept.name",
"sDefaultContent": ""
[/code]
---------
Using [code]"sAjaxSource": "php/join.php"[/code] I figured out the absolute URI to get the AJAX source data is:
http://editor.datatables.net/release/DataTables/extras/Editor/examples/php/join.php
(It would be nice if I didn't have to do this -- see previous post today, "Documentation hopes". Maybe I'm missing something though.)
The actual contents of the 'dept' object are as follows:
[code]
"dept":[
{
"value":"1",
"0":"1",
"label":"IT",
"1":"IT"
},
{
"value":"2",
"0":"2",
"label":"Sales",
"1":"Sales"
},
// **** trimmed for brevity... ****
{
"value":"7",
"0":"7",
"label":"Support",
"1":"Support"
}
]
[/code]
I don't get it. Where is the 'name' property?
Where is the 'id' property mentioned in the following code:
[code]
{
"label": "Department:",
// The 'id' value from the property is used to set the value
// of the select list.
"name": "dept.id",
"type": "select"
}
[/code]
This discussion has been closed.
Replies
[code]
{
"id": -1,
"error": "",
"fieldErrors": [],
"data": [],
"aaData": [{
"DT_RowId": "row_1",
"first_name": "Quynn",
"last_name": "Contreras",
"dept": {
"id": "1",
"name": "IT"
},
"access": [{
"id": "1",
"name": "Printer"
}, {
"id": "3",
"name": "Desktop"
}, {
"id": "4",
"name": "VMs"
}],
"extra": {}
},
[/code]
Going back to edit my post in your other thread based on this... :-)
Allan