简体   繁体   English

将数据从 Controller 传递到 Odoo 中的 JS

[英]Pass data from Controller to JS in Odoo

How can you pass data from a controller to JS.如何将数据从 controller 传递给 JS。 I'm trying to set the mindate on a date picker based on information in the controller qcontext.我正在尝试根据 controller qcontext 中的信息在日期选择器上设置思维导图。 I've hacked together a solution of rendering the data in an empty span tag and reading it from the span tag through JS... But I'm hoping there is a better way?我已经拼凑了一个解决方案,在一个空的跨度标签中呈现数据并通过 JS 从跨度标签中读取它......但我希望有更好的方法?

You have to call the json controller from the RPC-Call .您必须从RPC-Call调用json controller 。 Check this solution [Call Json Controller][1]检查此解决方案 [致电 Json 控制器][1]

This is the same concept from there you can modify with the requirement with pass the data and perform same.这是相同的概念,您可以根据需要修改并传递数据并执行相同的操作。 [1]: How to call an Odoo Controller function from JS file [1]: 如何从 JS 文件调用 Odoo Controller function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM