Change add_in_form default component

26 views
Skip to first unread message

Ruben Bordón

unread,
Dec 9, 2013, 9:46:21 AM12/9/13
to net...@googlegroups.com
Hi everybody!.. I'm trying Netzke and I want to know how can I change the add_in_form form, because I implement my own form, which code  I let you below:

class CategoriasProductoForm < Netzke::Basepack::Form

  def actions 
      super.merge({ 
        apply:  {:text => "Guardar", :disabled => false}
      }) 
  end 
  def configure(c)
  c.title = "Categoria de Productos"
    c.model = "CategoriasProducto"
    c.items =[
      {name: :str_nombre, field_label: "Nombre"},
      {name: :str_descripcion, field_label: "Descripcion"}
    ]
      c.bbar = [:apply]
    super
  end
  
end

and this is my custom Grid:

class CategoriasProductos < Netzke::Basepack::Grid
def configure(c)
c.model = "CategoriasProducto"
c.columns = [
      {name: :str_nombre, header: "Nombre"},
      {name: :str_descripcion, header: "Descripcion"}
    ]
    super
end
end

Can I use my custom form?.

Thanks.
Ruben

omar

unread,
Dec 9, 2013, 2:39:20 PM12/9/13
to net...@googlegroups.com
Hi Ruben
You can add in your grid definition an override for the add in form like this
*******************************************************
component :add_window do |c|
      super(c)
      c.width = 600
      c.title = 'Add Product'
      c.form_config.items = [
       {name: :str_nombre, field_label: "Nombre"},
       {name: :str_descripcion, field_label: "Descripcion"}
     ]
  end
******************************************************
Please add the above code in you Grid definition. This work in the last version of neztke for extjs4. May no work in previous version(I never use them)
Cheers
Reply all
Reply to author
Forward
0 new messages