how to design 3-tier table relationship
how to design 3-tier table relationship
Dear Sir,
I'd like to design a 3-tier table relation for customer.
for example:
TableA (parent):
(
id ,
name,
)
TableB(child of TableA):
(
id,
TableA_id (from parent),
id2
)
TableC(child of TableB)
(
id,
TableC_id (from id of TableB)
name
)
I built successfully TableA and TableB relationship as our example
but failed to link TableC.
I got an error messge from data function listed below.
data: function ( d ) {
var selected = TableB.row( { selected: true } );
if ( selected.any() ) {
d.TableC_id = selected.data().id;
}
}
Because I used explicitly field expression,
TableB.id, TableC.TableC_id in my editor and table column,
How can I replace "id" in "selected.data().id" with the right expression?
(If I replaced "selected.data().id" with "selected.data().TableB.id",
I'll got a wrong expression warnning) .
Hope to hear the right answer here!
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Replies
Can you give me a link to the page you are working on so I can see how you are configuring the DataTables, Editor and also the data being returned from the server please.
Allan
Hi Allan,
I've solved this issue already.
I just replace the statement
''' d.tag_tagvalue_id = selected.data().id '''
with
''' d['tag_tagvalue_id'] = selected.data().tag_tagvalue['id]'''
Thank you!