如何将整个单元格数组添加到一行中?我有这样的东西->
w = RubyXL::Workbook.new
w.add_worksheet("Test")
test_sheet = w["Test"]
test_sheet.add_cell(0, 0, "abc") #this adds abc to row 0 and column 0
arr = ["hello","again","hi","there"]
Run Code Online (Sandbox Code Playgroud)
有没有类似的东西
test_sheet.add_row(a)
Run Code Online (Sandbox Code Playgroud)
我可以在哪里将数组 arr 的所有内容转移到测试工作表中的一行,并将 a 的每个元素放在单独的单元格中?
我的代码结构如下 - >
MyApp-> app - > controller,model,store,shared(util-> Utility.js),view
我创建了以下实用工具类
Ext.define('MyApp.shared.util.Utilities', {
myFunction : function (val, meta, rec) {
//do something
return val;
}
});
Run Code Online (Sandbox Code Playgroud)
我试图在我的网格中渲染列时调用myFunction,如下所示 - >
Ext.define('MyApp.view.MyGrid', {
extend: 'Ext.grid.Panel',
initComponent: function() {
var rendererFn = Ext.create('MyApp.shared.util.Utilities');
this.columns = [{
text: 'Col1',
dataIndex: 'col1'
renderer: rendererFn.myFunction
};
this.store = new MyApp.store.MyStore();
this.store.load();
this.callParent(arguments);
}
});
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我想知道这是否是使用全局函数的正确方法.
我正在尝试使用 POST 和嵌套参数进行 Http Basic 身份验证。虽然外部参数工作正常(class.name - ActionController::Parameters),但嵌套参数是字符串(class.name - String)这是我的代码 ->
require 'net/http'
uri = URI('http://example.com/bulb/')
req = Net::HTTP::Post.new(uri)
req.basic_auth 'mytest@somesite.com', 'mypassword'
req.set_form_data('first_params' => 'a', 'seconnd_params'=>'b', 'netsed_params'=>{'first_netsed'=>'c', 'second_nested'=>'d'}, 'commit'=>'Create Bulb', 'action'=>'create', 'controller'=>'bulb')
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
case res
when Net::HTTPSuccess, Net::HTTPRedirection
# OK
else
#failed
end
Run Code Online (Sandbox Code Playgroud)
我可以使用什么其他库来使嵌套参数工作而无需手动转换它们。我发现这set_form_data不适用于嵌套哈希