How to access div inside Document Field

12 views
Skip to first unread message

Rohit Waghchaure

unread,
Jul 16, 2014, 1:40:32 AM7/16/14
to erpnext-dev...@googlegroups.com
Hi all,

I have added one custom field 'ABC' of Field Type 'HTML' on doctype Quotation. In the "Options" of that field i have written code <div style="width:100%" id="dynamic"></div>

On load, i have to fetch that div using id 'dynamic' and append a table to that div
My code is,

$("#dynamic").html('<table style="width:100%;overflow:none" class="display" id="datatable"><tr><td>Test Data</td></tr></table>') 

It is not working.
Is there any another way to access the div(id='dynamic') which is assigned to field 'ABC' ? please provide the solution

Thanks, Rohit

Anand Doshi

unread,
Jul 16, 2014, 1:58:54 AM7/16/14
to ERPNext Developer's Forum
Use refresh event and not onload.

-Anand.


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/ce12519f-fd2c-4bdc-9ce2-af52dc9a5067%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rohit Waghchaure

unread,
Jul 16, 2014, 2:23:33 AM7/16/14
to erpnext-dev...@googlegroups.com
Hi Anand,

Still it is not working.

To check the issue, i have added an alert below the actual code.

$("#dynamic").html('<table style="width:100%;overflow:none" class="display" id="data_table"><tr><td>WELCOME to jungle</td></tr></table>')
alert("hii") // to check the issue

I have seen that my first code is working when alert popup show on screen and when i click on ok to close the alert popup the table is not showing in the field.

Please provide the solution

Thanks, Rohit






Regards



For more options, visit https://groups.google.com/d/optout.



--
Rohit S. Waghchaure
Cell: +91 90118 57174 | Off. : (20) 657 0800 / 25281316
New Indictrans Technologies Pvt Ltd | www.indictranstech.com

Anand Doshi

unread,
Jul 16, 2014, 10:01:58 AM7/16/14
to ERPNext Developer's Forum
Hi Rohit,

If the alert is coming up, it means that you jquery has problems. You need to debut this using the console, like checking if $("#dynamic") returns anything, etc.

Thanks,
Anand.


Reply all
Reply to author
Forward
0 new messages