wando_grid 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/wando_grid.rb +14 -18
  2. metadata +1 -1
data/lib/wando_grid.rb CHANGED
@@ -9,10 +9,6 @@ module WandoGrids
9
9
  # loadData: 是否自动加载数据
10
10
 
11
11
  # wando_grid的入口函数,返回请求记录,和记录总数
12
- def hello
13
- puts "world"
14
- end
15
-
16
12
  def wando_grid(params, object, option = {}, toLoadData = true)
17
13
  object, result = wando_grid_in_json(params, object, option, toLoadData)
18
14
 
@@ -144,24 +140,24 @@ module WandoGrids
144
140
  fs
145
141
  end
146
142
 
147
- #def wando_grid_for_array params, array
148
- # fields, column_name, result = [], [], []
143
+ def wando_grid_for_array params, array
144
+ fields, column_name, result = [], [], []
149
145
 
150
- # relations = JSON.parse(params[:columnsConfig])
151
- # relations.each do |o ,e|
152
- # fields << e
153
- # column_name << o
154
- # end
146
+ relations = JSON.parse(params[:columnsConfig])
147
+ relations.each do |o ,e|
148
+ fields << e
149
+ column_name << o
150
+ end
155
151
 
156
- # column_name.push("id")
157
- # records = array.provide(*column_name)
152
+ column_name.push("id")
153
+ records = array.provide(*column_name)
158
154
 
159
- # records.each do |r|
160
- # result << Hash[r.map {|k, v| [relations[k], v] }]
161
- # end
155
+ records.each do |r|
156
+ result << Hash[r.map {|k, v| [relations[k], v] }]
157
+ end
162
158
 
163
- # render :json => { :success => true, :total => array.count, :result => result }
159
+ render :json => { :success => true, :total => array.count, :result => result }
164
160
 
165
- #end
161
+ end
166
162
 
167
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wando_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: