Do anyone know how to edit the ids-objects.php to include columns from multiple tables.
Do anyone know how to edit the ids-objects.php to include columns from multiple tables.
I am working with the sever side row_details.html.
I am trying to create a table that shows the sales ordres (customerName, soDate, notes)
The row details will pull from another table called lineItems.
I could just create another ajax because I am able to search by d.id
However I thought it would be best not duplicate code.
I thought I could have the first table show as d.id, d.customerName, d.soDate, d.notes)
Then have the second table show as i.product ,i.qty, i.price i.so_ID (Where i.so_ID = d.id)
Thanks a bunch for any help you can provide.
Peter
This question has accepted answers - jump to:
Answers
Hi Peter,
Are you doing this with Editor (which I see you purchased earlier today - thanks!)? If so, I would suggest ignoring the
ids-objects.php
example and use the Editor PHP libraries to do this as they has support for join tables built in, while theids-objects.php
file (and its supporting class) does not.In particular, take a look at the join examples for Editor.
Indeed, even if you aren't using Editor in this case, you can use the
Editor
PHP class to still load the data using theleftJoin()
method that is used in that example just to load the data. Simply don't provide any editing interface to stop editing!You might also find the Editor join documentation useful.
If you have any questions about it, please do let me know.
Regards,
Allan
Thanks
I am able to load and use the editor join array. I think I sent and support email just after I purchased the editor.
I would like to be able to add row details to the joinarray.html
For example I want to have a sales order - The parent row shows basic information such as order# customer, notes, user. Then when the row is expanded it shows line item details from another table
For example
Sales Order # Customer Notes User
60 Grady Blah blah blah John
+ Product QTY Price
Shirt 10 25.95
Pants 5 12.95
Glove 4 8.95
Hat 10 15.95
61 Kennestone Blah blah Blah Mark
62 Piedmont Blah blah blah Steve
Etc Etc
Thanks
Peter
Hi Peter,
Sounds good. Do you have a join table set up and working just now? That would be the first step I would suggest, and ignore the child rows in the first instance as they can easily be added once the basic table is up and running.
Once it is, the child row code from the row details example and be used (specifically lines 38 - 53 for the action, and also 24 to 29 to show the details control - in the Javascript block shown below the table).
Regards,
Allan
Thanks for all your help
I have the join table set and working.
However when I add the lines 38 - 53 and 24-29 The data no longer appears.
When I inspect in the console.log the error message is :
Uncaught TypeError: Cannot read property 'style' of undefined - jquery.datatables.js 4061
I noticed in the rowdetails examples that on line 23 the columns is in quotes "columns"
However in the joinArray.html there are no quotes. I was not sure if this was the problem I am having.
Here is the code I have
Thanks again for all your help
Shouldn't make any difference in this case. The quotes are optional in Javascript (required in JSON).
In the code you have 5 columns defined in the
columns
array. Do you also have 5 columns in the HTML? The error you are getting makes me suspect that there are only 4.The HTML and the Javascript must agree on the number of columns, otherwise errors such as this can occur.
Regards,
Allan
Sorry I a little confused.
Is the
counting as a column
I then have 4 columns
My HTML code is as follows
Thanks
Peter
I was able to add <th> </th> and get the additional column problem fixed.
However it is not showing the expand button + and -
Thanks I really appreciate all this help!!!!!!
I was able to add the buttons so I have that all fixed now.
Thanks for your help
I am trying to add the table tools now for Copy CVS Print PDF
I added :
and
I copied the filed to the same directory
Here is my code. I can not figure out what I am doing wrong
Thanks
Hi Peter,
Yes - each entry in the
columns
array is a column.Excellent to hear :-)
In your DataTables initialisation you are using the
aButtons
array of buttons to define the TableTools buttons for Editor. If you would like the export buttons to appear also they need to be added to the array as well.For example you might end up with:
Regards,
Allan
Awesome
You Rock!!!!
This plugin is super helpful. Thanks for all the work you have done on this!!!!!!!!!!!!
Ok I have the COPY, XLS, CVS, PDF and print working.
Where do I edit to get those buttons to float right?
Good to hear that worked!
You can use a little CSS to move the buttons around. In this Editor example I use a little margin to separate the buttons:
You could also add
float:right
options and any other CSS required to the buttons to get the layout required. I would suggest using the browser's "Inspect element" option to take a look at the HTML for the buttons so you can see the structure and target the buttons you want with the required CSS.Regards,
Allan