Results 1 to 6 of 6

Thread: Grid as Form Field

  1. #1

    Default Grid as Form Field

    Hi all,

    i need some hints how to pu t a grid into a form panel, which is filled with the xmldata loaded by the form. how can i add the grid content to the values of the form on submit?

    the idea is to drag items from a tree into the grid and submit the "chosen" items...

    i am getting nearly mad, i did not yet found any advice on the web how to connect data storage and grid with the form...

    another problem is that form fields, which are defined after the grid element are not rendered and the panel looks weird finally....

    any suggestions?

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664

    Default

    As to layout, you can see http://examples.extjs.eu/?ex=treeinform, just replace tree with grid. Additionally, you need to supply getValue function for the grid.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  3. #3

    Default

    It is quite easy to add a tree into a form, but how can i add a grid into my form which is filled with data which comes from the xml the form loads?

    my xml content looks like this:
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ajax success="1">
    	<product>
    		<id>2</id>
    		<name>Testprodukt</name>
    		<admin_user_id>0</admin_user_id>
    		<admin_user_name></admin_user_name>
    		<create_date>2009-03-12 11:23:55</create_date>
    		<publish_date></publish_date>
    		<expire_date></expire_date>
    		<live>1</live>
    		<short_desc>test</short_desc>
    		<note>dwdqwdqw</note>
    		<manufacturer_id>1</manufacturer_id>
    		<manufacturer_name>test-m</manufacturer_name>
    		<manufacturer_sku>1234</manufacturer_sku>
    		<sku>tp-dt-2321</sku>
    		<categories>
    			<category>
    				<id>3</id>
    				<unqualified_path>/Film/Camera Equipment/Camcorder</unqualified_path>
    			</category><category>
    				<id>4</id>
    				<unqualified_path>/Film/Camera Equipment/System Cameras</unqualified_path>
    			</category>		</categories>
    	</product></ajax>
    (could have been formatted a bit better, i know)

    I want to have a row in the grid for each <category>... it is quite difficult for me to understand how to add the data to the storage...

  4. #4

    Default

    no one who might help?

  5. #5
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664

    Default

    Loading the grid with xml data and placing it to a form are two different tasks. The best source of info on loading is http://extjs.com/deploy/dev/examples...edit-grid.html and http://extjs.com/learn/Ext_FAQ_Grid.

    For having the grid in a form you need to write setValue and getValue functions.

    Grid in form is pretty much similar to Combo in form.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  6. #6
    Sencha Premium User Mjollnir26's Avatar
    Join Date
    Oct 2008
    Location
    Germany
    Posts
    174

    Talking

    Had the same Problem (injecting Grid as Form-Field).
    Based on Saki's Example i defined my Grid with the following Options and now it works perfectly:

    Code:
                                                                   fieldLabel: 'Angebote',
                                                                    isFormField: true,
                                                                  
                                                                    getName: function()
                                                                    {
                                                                        return 'existingOffers';
                                                                    },
                                                                    
                                                                    dataIndex: 'existingOffers',
                                                                    
                                                                    getValue: function()
                                                                    {
                                                                        return true;
                                                                    },
                                                                    
                                                                    setValue: function(v)
                                                                    {
                                                                    },
    Last edited by Mjollnir26; 26 Mar 2009 at 7:57 AM. Reason: messed up indentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •