Need Extra Data Set access in createdRow
Need Extra Data Set access in createdRow
INTONE
Posts: 153Questions: 58Answers: 6
I am trying to get access to extra data in the createRow of dataTables but that data set is not accessible. I create the dataset from the server like this:
$data = Editor::inst( $db, 'message', 'message.messageID' )
->fields(
///fields
);
$out = $data->process( $_POST )->data();
if(!isset($_POST['action'])){
$out['isRead'] = $data->db()->sql( " SELECT a.`createdBy`,b.`isRead`,b.`messageID`,b.`recipientID`
FROM message a, messageRecipient b
WHERE a.`messageID` = b.`messageID`
ORDER BY a.createdAt DESC")->fetchAll();
}
echo json_encode( $out );
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm not clear on what extra data it is that you are string to access. Could you clarify your question a little please?
Allan
I am building a simple messaging system. I have a table called message and another called messageRecipient. 'message' store the message while message recipient store the ids of all those who got the message plus 'isRead' and 'isReadDate'. I am already using a mjoin on the contacts table to get the people to sent the message to. I know I can use mjoin the get the extra data from the messageRecipient table but I do not want to write any I just want to read, hence my additional query at the bottom in the
block. Here is my summarized code:
The problem is that I am seeing isRead dataset but it is not accessible in the createRow of datatables.
Use use
Mjoin->set( false )
in that case and keep it in the Mjoin.No - you would need to merge it into the
data
array that contains the information about each row.Allan