是否可以直接从Groovy返回java.sql.ResultSet?(Is it possible to directly return the java.sql.ResultSet from Groovy?)
我有一个Groovy脚本使用
groovy.sql.Sql
类与数据库进行通信,但是一些遗留Java代码期望接收java.sql.ResultSet
。 有没有办法使用groovy.sql.Sql
执行SELECT
查询并直接返回java.sql.ResultSet
?I have a Groovy script that is using the
groovy.sql.Sql
class to communicate with the DB, but some legacy Java code is expecting to receive ajava.sql.ResultSet
. Is there any way to execute aSELECT
query usinggroovy.sql.Sql
and directly return thejava.sql.ResultSet
?
原文:https://stackoverflow.com/questions/31947812
最满意答案
您似乎正确地编写了内联任意代码的语法,但是范围存在问题。
this
是指Ext.XTemplate
本身的实例,而不是表视图。您应该尝试另一种方式来获取表实例的引用,例如,在表的定义文件中:
initialize: function(){ var me = this; me.setTpl('Ext.XTemplate', // blah blah ... // now you can use "me" to refer to your table instance ) }
It seems you wrote the syntax for inline arbitrary code correctly, but there's a problem with scope.
this
refers to the instance ofExt.XTemplate
itself, not the table view.You should try another way to get the reference of your table instance instead, for example, in your table's definition file:
initialize: function(){ var me = this; me.setTpl('Ext.XTemplate', // blah blah ... // now you can use "me" to refer to your table instance ) }
相关问答
更多-
我假设您正在为您的数据使用模型和商店? 如果是这样,我建议你使用字段中提供的转换方法。 它允许您将该cat字段转换为tpl可以理解的更好的数据。 Ext.define('MyModel', { extend: 'Ext.data.Model', config: { fields: [ { name: 'cat', convert: function(values, record) { ...
-
列表模板不是为使用组件而设计的,但您应该能够在数据视图中使用它们。 另一种方法是将按钮的div添加到模板中,然后使用模板上的成员函数创建并向div渲染按钮。 List templates are not designed to use components, however you should be able to use them in dataviews. Another method is to add a div for the button to your template, and then ...
-
您可以在推送列表视图之前过滤控制器中的商店: store.filter('isvisible', '1'); http://docs.sencha.com/touch/2.2.1/#!/api/Ext.data.Store-method-filter 编辑: initialize: function(list) { var data = []; Ext.each(list.getData(), function(rec) { if (rec.data.isvisible ...
-
第一步是确保您的更新方法将被执行。 没有足够的信息来弄清楚你的代码发生了什么。 看起来您的更新方法位于视图中,并引用了this.down,因此您需要确保您使用的组件可以访问商店。 如果你不这样做,你可以传递一个对象来更新模板,如http://new.senchafiddle.com/#/7mAmV/ 。 The first step would be to make sure your update method would be executed. Not really enough info to fi ...
-
覆盖Sencha Touch类(Override Sencha Touch class)[2023-09-09]
在查看Sencha Touch代码时,我认为您必须向面板的eventedConfig属性添加material ,因为set touch/src/Evented.js的setter设置如下: for (name in eventedConfig) { if (eventedConfig.hasOwnProperty(name)) { nameMap = ExtClass.getConfigNameMap(name); data[nameMap.set] = this.g ... -
这是一个简单的问题,但是当你开始时可能是一个瓶颈...将商店中的pageParam设置为你在服务器端用于分页的内容......那么一切都应该正常工作...... 注意:您的实际分页逻辑应位于服务器端... Sencha仅提供一种方法来一次显示几个内容... Ext.define('MyApp.store.MyJsonStore', { extend: 'Ext.data.Store', config: { storeId: 'MyJsonStore', proxy: { t ...
-
sencha / javascript - 如何从tpl模板中调用函数(sencha / javascript - how to call a function from inside a tpl template)[2022-06-08]
如果您明确声明了XTemplate,则可以使用最后一个构造函数参数,该参数接受可以指定模板函数的配置对象。 这些函数可以使用value:function语法来调用。 你的代码将变成: t_news = new Ext.Component({ cls:'t_news', title:'News', scroll: 'vertical', tpl: new Ext.XTemplate( '', ' ', ...Sencha Touch 2,使用get组件获取视图的名称(Sencha Touch 2, get the name of the view from using get component)[2021-07-31]
使用Ext.ClassManager.getClass(component); Use Ext.ClassManager.getClass(component);您似乎正确地编写了内联任意代码的语法,但是范围存在问题。 this是指Ext.XTemplate本身的实例,而不是表视图。 您应该尝试另一种方式来获取表实例的引用,例如,在表的定义文件中: initialize: function(){ var me = this; me.setTpl('Ext.XTemplate', // blah blah ... // now you can use "me" to refer to your table instanc ...您定义了地图视图和扩展的Ext.Map ,以便视图成为地图,当您为视图指定xtype时,它不应该是预定义的xtype,如地图,面板,按钮等。 您应该学习Ext类系统并尝试此代码。 Ext.define('myapp.view.Map', { extend: 'Ext.Map', xtype: 'mymap', config: { layout: 'fit', iconCls: 'icon-location', title: 'Locat ...相关文章
更多- Groovy 快速入门程序
- Groovy 方法详解
- Tomcat源码里,return (factory)有特殊作用么
- groovy解析的类实例序列化后无法readObject
- Gradle构建Groovy项目
- Spring4新特性——Groovy Bean定义DSL
- Groovy 数字类型
- Groovy 变量详解
- Groovy def可选类型
- Groovy 运算符详解
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。