Method: ExtNode#to_extjs

Defined in:
lib/extjsml/basenode.rb

#to_extjs(at_deep = 0) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/extjsml/basenode.rb', line 211

def to_extjs(at_deep = 0)
  # if self.before_filters.count > 0
  #   self.before_filters.each do |method|
  #     self.send method, at_deep
  #   end
  # end

  ref = conv_id_to_ref
  # if not root? and ref
    # TODO skip if id is the same of instance method
    # puts "../"*(at_deep == 0 ? 0 : at_deep-1 ) + conv_id_to_ref unless @config[:id].nil?
    # @config = @config.merge({ :ref => "../"*(at_deep-1) + conv_id_to_ref }) unless @config[:id].nil?
  # end

  # not gen id
  @config[:cmp_id] = conv_id_to_ref
  unless @@generator[:noid].nil? 
    # skip if force gen id
    unless @config[:forceId]
      # remove id
      @config.delete :id
      # @config[:id] = ExtUtil.random_id
    end
    # gen random id for ref
  end

  collect_events
  # TODO remove ref for *column xtype ?
  collect_ref(ref)

  if has_child?
    child_h = { :items => [] }
    childs.each do |c|
      child_h[:items] << c.to_extjs(at_deep + 1) 
    end
    h = {:xtype => @xtype}.merge(@config).merge(child_h)
  else
    {:xtype => @xtype}.merge(@config)
  end
end