What I would like is to have the table view of parent records and table view of child records on the same page. Then when you click on a parent record, the the list of records in the child table view would update to show the child records for the parent selected.
Is this possible?
If it is, how would I do accomplish this?
See attached file to see image of what I am after.
Thanks,
TD
Parent / Child Table View Same Page?
Parent / Child Table View Same Page?
- Attachments
-
- parent child table views same page.png (37.11 KiB) Viewed 2267 times
Re: Parent / Child Table View Same Page?
Would be a lot of work, I'm afraid.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Parent / Child Table View Same Page?
I have tried.
The problem is not embedding Detail View's Children-Tabs into Table View for the selected record, see screenrecording:
But for me the problem is passing over the Table View selection and filters into the child's details, for example when creating new children:
Right now I don't have any good solution. Hopefully others have.
The problem is not embedding Detail View's Children-Tabs into Table View for the selected record, see screenrecording:
But for me the problem is passing over the Table View selection and filters into the child's details, for example when creating new children:
Right now I don't have any good solution. Hopefully others have.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Parent / Child Table View Same Page?
Thanks jsetzer for trying to help. Yes, hopefully someone has a solution.
TD
TD
Re: Parent / Child Table View Same Page?
Hi,
actually jsetzer shows how to do it. As I don't want to take the credit for others, I just add the trick to show the preselected reference.
Add to the DOM a hidden input field with name="SelectedID". Then, on the selection of the row from the top table, set the SelectedID as the data-id value. If you click on add new it should use that value to populated the selection.
actually jsetzer shows how to do it. As I don't want to take the credit for others, I just add the trick to show the preselected reference.
Add to the DOM a hidden input field with name="SelectedID". Then, on the selection of the row from the top table, set the SelectedID as the data-id value. If you click on add new it should use that value to populated the selection.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Parent / Child Table View Same Page?
jsetzer can you explain how you did what you did in the gif you posted?
Thanks,
TD
Thanks,
TD
Re: Parent / Child Table View Same Page?
- In
hooks/TABLENAME-tv.js
I have added a<div/>
using jQuery as a placeholder for the children tabs and named itTABLENAME-children
- Then I have added a button* to the first cell of each row of the table view.
* Due to an agreement with Ahmed I must not show how I did this because I'm using a commercial product. Giving help based on commercial products is not welcomed in the free community area of this forum. Just add buttons to each row by using Javascript. - On button-click I'm using
.load
-function of jQuery and fetch server-data fromparent-children.php
, which is the built-in script for retrieving children-tabs in the Detail View. I'm just re-using the detail-view code in the table view. - Parameters for loading the children-tabs:
- ParentTable: AppGini.currentTableName()
- Operation: 'show-children'
- SelectedID: YOURCURRENTPRIMARYKEYHERE
Here is some code excerpt inside document.ready:
Code: Select all
jQuery("<div/>").attr("id", `${AppGini.currentTableName()}-children`).addClass("children-tabs hidden").insertAfter(jQuery("table"));
// YOUR_FUNCTION_FOR_ADDINGBUTTONS
// YOUR_BUTTON_ONCLICK_HANDLER should execute:
function(pk) {
jQuery(`#${AppGini.currentTableName()}-children`).load("parent-children.php", { ParentTable: AppGini.currentTableName(), Operation: 'show-children', SelectedID: pk }, function() {
jQuery(`#${AppGini.currentTableName()}-children`).hide().removeClass("hidden").fadeIn();
};
};
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Parent / Child Table View Same Page?
Hi,
here would be my proposal without an additional commercial product.
here would be my proposal without an additional commercial product.
Code: Select all
$j(function(){
const tablename=AppGini.currentTableName();
$j('body').append('<input name="SelectedID" value="1" type="hidden">');
$j('[data-table="'+tablename+'"]').parent('.row').append('<div id="'+tablename+'-children"></div>');
btn='<button type="button" class="childtable btn btn-sm" title="Show child table"><i class="glyphicon glyphicon-search"></i></button>'
$j('[data-table="'+tablename+'"] tbody tr td:first-child input').after(btn);
$j('[data-table="'+tablename+'"] tbody tr td:first-child').attr('nowrap','');
$j('.childtable').on('click',function() {
id=$j(this).parents('tr').attr('data-id');
$j('[name="SelectedID"]').val(id);
post('parent-children.php', {ParentTable: tablename,SelectedID: id,Operation: 'show-children'},tablename+'-children');
})
})
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Parent / Child Table View Same Page?
thanks a lot Mr. pböttcher
i already user your code and make some change NOW its look like that
thanks again
i already user your code and make some change NOW its look like that
thanks again
Re: Parent / Child Table View Same Page?
Hi,
glad it works.
Maybe you can post the code you are using, so that might be also useful for others.
glad it works.
Maybe you can post the code you are using, so that might be also useful for others.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Parent / Child Table View Same Page?
this my code on table-tv.js
Code: Select all
$j(function(){
$j('#NoFilter').after('<button class="btn btn-info btn-lg" type="button" onclick="myFunction()" id="Show_Child"><i class="glyphicon glyphicon-search"></i> Show Child </button>');
});
function myFunction() {
const tablename=AppGini.currentTableName();
$j('body').append('<input name="SelectedID" value="1" type="hidden">');
$j('[data-table="'+tablename+'"]').parent('.row').append('<div id="'+tablename+'-children"></div>');
btn='<button type="button" id="btn" class="childtable btn btn-primary btn-sm" title="Show child table"><i class="glyphicon glyphicon-search"></i></button>'
$j('[data-table="'+tablename+'"] tbody tr td:first-child input').after(btn);
$j('[data-table="'+tablename+'"] tbody tr td:first-child').attr('nowrap','');
$j('.childtable').on('click',function() {
id=$j(this).parents('tr').attr('data-id');
$j('[name="SelectedID"]').val(id);
post('parent-children.php', {ParentTable: tablename,SelectedID: id,Operation: 'show-children'},tablename+'-children');
})
}