Results 1 to 6 of 6

Thread: How to render single record from DataView on a Panel

  1. #1

    Default How to render single record from DataView on a Panel

    Hi,
    I'm new to ExtJs and I try to render a single record out of a DataView (which is connected to a Store) onto a Panel, but it won't work :-(

    I have 12 panels, which are placeholders. Each placeholder has to hold (show) a record from the store using the DataView. (The placeholders should be filled via drag'n'drop operations and they also can be empty).

    sortedProductView.getNode(i) doesn't work, because the elements array in the DataView is empty. I think, it will be filled, if the DataView has to be rendered, or?
    But also while rendering the dataview to a hidden dom element it is not possible to show one record on each panel. What am I doing wrong?
    Or how can the record - placeholder problem be solved?

    Here is my code:
    Code:
    sortedProductView = new Ext.DataView({
        cls: 'product-view',
        tpl: '<tpl for=".">' +
                '<div class="product product-select product-target"><table><tbody>' +
                    '<tr><td class="product-label">Image</td><td class="product-name"><img src="{image}" /></td></tr>' +
                    '<tr><td class="product-label">Name</td><td class="product-name">{title}</td></tr>' +
                    '<tr><td class="product-label">SKU</td><td class="product-name">{sku}</td></tr>' +
                    '<tr><td class="product-label">Designer</td><td class="product-name">{designer}</td></tr>' +
                '</tbody></table></div>' +
             '</tpl>',
        itemSelector: 'div.product-select',
        overClass: 'product-over',
        selectedClass: 'product-selected',
        singleSelect: true,
        store: sortedProductStore,
    });
    
    var placeholders = new Array();
    for(var i=0; i<12; i++){
        placeholders.push({
            xtype: 'panel',
            title: 'placeholder',
            width: 150,
            height: 150,
            cls: 'product-placeholder',
            items:[{
                xtype: 'tbbutton',
                text: 'remove',
            },
               sortedProductView.getNode(i) //Dosn't work!
            ],
            listeners: {
                render: initProductDropZone
            }
        });
    }
    
    var sortedProductsPanel = new Ext.Panel({
        title: 'Category View',
        columnWidth: .5,
        height: 400,
        autoScroll: true,
        items: placeholders,
        layout: 'table',
        layoutConfig: {
            columns: 3
        },
        defaults: {
            style:'margin: 20px',
        },
    });

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    This looks like something for my ComponentDataView user extension (rendered components - like a Panel - inside a DataView).

  3. #3

    Default

    I already tried to use your extension but it won't work either, because I also need empty placeholders which aren't 'connected' with a record...

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Do you really need a dataview? You could also build panels from the store data and add them to the container. The only thing you are missing then is the automatic update when the store changes.

  5. #5

    Default

    oh, that sounds good. Please, can you give me a hint (or link) how to do that?

  6. #6
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel

    see properties: data, tpl

    As Condor mentioned you could implement a method setData that updates the panel proper dynamically with different data.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Similar Threads

  1. JsonStore for a single record?
    By js_coder in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 28 Apr 2011, 2:57 AM
  2. XmlReader does not work with a single record.
    By margozzi in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 28 Dec 2010, 8:38 AM
  3. XmlReader not working with a single record
    By margozzi in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 20 Dec 2010, 4:21 PM
  4. Updating single record of the store
    By dev_java in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 25 Aug 2010, 12:21 AM
  5. Data request a single record
    By aityahia in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 19 Mar 2009, 8:26 AM

Tags for this Thread

Posting Permissions

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