Sha256: 886b65047cce4eaaf3f75173f63ef31244f79dc6279b6d53d2aa60c1dcdcc636

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

class Netzke::TreePanel < Netzke::Base
  api :get_children
  
  def self.js_base_class
    "Ext.tree.TreePanel"
  end
  
  def self.js_extend_properties
    {
      :root => {:text => '/', :id => 'source'}
    }
  end
  
  def js_config
    super.deep_merge({
      :loader => {:data_url => global_id+"__get_children".l}
    })
  end
  
  def get_children(params)
    klass = config[:data_class_name].constantize
    node = params[:node] == 'source' ? klass.find_by_parent_id(nil) : klass.find(params[:node].to_i)
    node.children.map{|n| {:text => n.name, :id => n.id, :leaf => n.children.empty?}}
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netzke-basepack-0.5.6 lib/netzke/tree_panel.rb
netzke-basepack-0.5.5.1 lib/netzke/tree_panel.rb
netzke-basepack-0.5.5 lib/netzke/tree_panel.rb