Editor not invoked in child table
Editor not invoked in child table
Hi everyone..
Given below is the link to my page where I have used parent-child system.
https://e-reporting.in/Data/HTC_Bill/index1.php
When I expand the first column i.e. Bill **of any row, the child table gets populated and new row could be added using Add Bill button. But when click on subsequent rows to expand them, the **Add Bill Button doesn't work as an **empty editor **without any fields do appear.
Please see and help me to get rid of the above.
Thanks & Regards
Shatrughan Sangwan
This question has accepted answers - jump to:
Answers
My primary table is htc. Here is how I coded the parent-child tables but editor in child table is working once after loading.
The above code snippet is inside of $(document).ready(function ().
Regards,
Shatrughan
Seems like your code should work. Even opening, editing, closing and reopening the same child row fails. The only thing I see that stands out as different from the https://datatables.net/blog/2019-01-11#Creating-a-DataTable">example code is you aren't using
table.detach();
. This may be needed for the Editor to properly attach to the next Child Row.Kevin
Thanks @kthorngren
I tried table.detach() as well but to no avail as the problem still persits.
Also, opening a new row without closing the already open met with the same fate while using its child editor.
Shatrughan
I found a thread -
http://live.datatables.net/mukirowi/55/edit
but, I couldn't figure out how to incorporate Editor with each of the tables.
Please suggest...
The blog I linked is from the developer and provides the proper solution. The other thing I noticed is you use
id
for the child tables where the blog example does not. There is a link to the full JS code here. Maybe comparing ti to yours you will find the issue.Kevin
@Kevin Sir, the blog you mentioned reflects Parent-Child tables upto two levels only but I am in need of three and as such I used http://live.datatables.net/mukirowi/55/edit which works fine but unable to code editor part properly. Please guide.
Are you in need of using Editor for the third level? Your example doesn't show it.
As I mentioned the best and cleanest option is to follow the blog example. You can create a child level be adding the
.detail-control
to the first child and using an event that calls a different function to open the second child.I took the blog example and added a second child here:
http://live.datatables.net/hakatehi/1/edit
Removed all the ajax calls for the child as I don't have access to the server scripts in the blog. The Editor works in standalone mode. I enabled the second child with Editor but you don't have to. Note the use of
stopPropagation()
to keep the parent table click event from running when opening the second child. I also needed to incorporaterowId
andidSrc
for the Editor to work in the example. You probably won't need to worry about this.Kevin
Thanks a lot , Kevin
One more help please..
I want to change the background of child table.
How to set css thereof ?
If you inspect the child row you will see that it is a child of a
tr
. After therow().show)
statement you can use something liketable.parent().css('background', '#90b2e8');
to set the background color. For example:http://live.datatables.net/hakatehi/3/edit
Kevin
Thanks Kevin once again...You are so generous.
Is there any option to set width of label of particular field ...Actually, I have a radio field with four options but one of them gets placed below in next row. To get it placed properly, I want the width of label be reduced to the max possible.
Please suggest ..
Thanks & Regards
Shatrughan Sangwan