在用rails+ext开发的时候 ,用上comboBox的兄弟可以参考一下!
server side:
def combo_data
sort_col = (params[:sort] || 'id')
sort_dir = (params[:dir] || 'ASC')
page = ((start/size).to_i)+1
@attrOptions = AttrOption.find(:all,
:select => "id, attr_feature_no",
:order=>sort_col+' '+sort_dir)
return_data = Hash.new()
return_data[:AttrOptions] = @attrOptions.collect{|u| {:id=>u.id,
:attr_feature_no=>u.attr_feature_no
} }
render :text=>return_data.to_json
end
client side:
var attr_feature_no = new Ext.form.ComboBox({
store:new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:'http://localhost:3008/attr_options/combo_data'}),
reader:new Ext.data.JsonReader({root:'AttrOptions',id:'id'},['id','attr_feature_no'])
}),
loadingText:'正在加载...',
displayField:'attr_feature_no',
valueField:'id',
mode:'remote',
triggerAction:'all',
hiddenName:'id',
fieldLabel:'属性号',
emptyText:'请选择...',
editable:false,
allowBlank:false,
width:110,
maxHeight:150,
tabIndex:4
});
分享到:
相关推荐
Rails GUI Development with Ext JS 10-Jan-08 RUG-B [PDF文件] 博文链接:https://taito.iteye.com/blog/208227
rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails 2.3.2离线安装rails ...
[Pragmatic Bookshelf] Crafting Rails Applications Expert Practices for Everyday Rails Development (E-Book) ☆ 图书概要:☆ Rails 3 is a huge step forward. You can now easily extend the framework, ...
Ruby on Rails Guides v2 - Ruby on Rails 4.2.5
《Ruby on Rails Tutorial》中文版(原书第2版,涵盖 Rails 4) Ruby 是一门很美的计算机语言,其设计原则就是“让编程人员快乐”。David Heinemeier Hansson 就是看重了这一点,才在开发 Rails 框架时选择了 Ruby...
《Rails之道》按照Rails的各个子系统进行组织编排,分别介绍了Rails的环境、初始过程、配置和日志记录,Rails的分配器、控制器、页面生成和路由,REST、资源和Rails,ActiveRecord的基础、关联、验证和高级技巧,...
一个用Ruby on Rails搭建的图片分享的网站项目.完整源代码
本资源是参照rails敏捷开发第四版书中的例子,rails的版本是rails3.2.6
Bootstrap 3 和 Rails 4(样例用的是Ruby 2.1.1,Rails 4.1.4) Table of Contents Preface 1 Chapter 1: Introducing Web Application Development in Rails 7 Why Bootstrap with Rails? 8 Setting up a Todo ...
adminlte-rails, AdminLTE Rails gem 将AdminLTE主题与 Rails 资产管道集成 AdminLTE Rails gem AdminLTE 是后端的高级 Bootstrap 主题。英镑 AdminLTE Rails gem 与 Rails 资产管道集成了英镑AdminLTE主题。安装将...
NULL 博文链接:https://lzqustc.iteye.com/blog/439128
Ruby on Rails helps you produce high-quality, beautiful-looking web applications quickly. You concentrate on creating the application, and Rails takes care of the details., Tens of thousands of ...
中文世界唯一一本Rails 4.0.0 + Ruby 2.0.0 的自學書籍
使用Aptana+Rails开发Rails Web应用 有Aptana的安装配置等等,中文
rails指南 中文版
Ruby On Rails 框架自它提出之日起就受到广泛关注,在“不要重复自己”,“约定优于配置”等思想的指导下,Rails 带给 Web 开发者的是极高的开发效率。 ActiveRecord 的灵活让你再也不用配置繁琐的 Hibernate 即可...