English 中文(简体)
Netzke / ExtJS 4 - How to implement Dynamic number of Panels inside an Accordion Panel
原标题:
  • 时间:2011-09-08 01:25:55
  •  标签:
  • netzke

I am trying to read strings off a table in the database and use them as titles in panels inside an accordion panel. In short the number of panels inside the accordion can change dynamically.

Here is a gist of what i tried - https://gist.github.com/1199695. I get the names from the table with an endpoint in my Ruby class. The returned data contains a string for the client JS function (named addPanel) which is called to add the Panel inside the accordion.

The code executes as i expected but the panels inside the accordion do not show up.

My suspicion is that the rendering is happening before the items get into the accordion.

If i hard code the addition - via class_name.items.add(new Ext.panel.Panel({:title "My panel"}) ) inside the initComponent then i can see the panel titled "My panel" inside the accordion.

Let me know if this is the correct way to approach the problem?

Thanks

最佳回答

Do you need the accordion panes to be Netzke components? If not, then you could try out something like:

 def configuration #:nodoc:
    super.merge({
       # ...

       :items => some_model.all.map{|item| {:item => item.title}}
    })
  end

Briefly, you just provide your Ext.tab.Panel-based class with the dynamic items configuration (taken from the model).

问题回答

暂无回答




相关问题
4条铁路 网格不可见

我和ExtJs 4.x和Netzke 宝石玩(netzke- basepack (0.74) netzke-camp (0.75) netzke-core (0.7.5) netzke-pistence (0.1.0) ) 我配置得完全正确,但当然,我看不到有问题...

How can I use devise helper in netzke?

I m using Devise and Netzke gems. My rails version is 3.1.1 I want to access a devise helper (current_user) in netzke component. But it not in model or views. It in rails_root/app/component/...

Netzke, RAILS 3.1

我在这里是关于Netzke的。

Is anyone using Netzke in production?

I m building an Ext.js application, and I m planning on using rails for the backend. I m trying to decide whether to use Netzke, or roll my own. Is anyone using Netzke in production?

热门标签