Results 1 to 10 of 10

Thread: Values saving in dataview

  1. #1
    Sencha User
    Join Date
    Feb 2010
    Posts
    30

    Default Values saving in dataview

    I have textboxes and a check box and two radio buttons. Can anyone help me out how i can save these fields value on onchage events: my code is:

    Code:
    xtype: 'form',
    id: 'phyexam_show_all_sys_panel' + r.get('id'),
    frame: false,
    autoScroll: true,
    border: false,
    items: new Ext.DataView({
        store: new Ext.data.JsonStore({
            url: 'connect.php',
            baseParams: {
                moduleId: moduleId,
                action: 'doAction',
                section_name: 'ALL',
                activity: 'getROS'
            }, autoLoad: true,
            root: 'ALL',
            fields: ['section', 'section_item', 'id']
        }),
        tpl: new Ext.XTemplate('<tpl for=".">', '<div class="ros-wrap-class"  title="{section}">', '<div class="ros-textbox-class">', '<span style="font-size:12px">{section_item}</span><br/>', '<input type="text" onkeyup="alert(this.value)">', '</div>', '<div>', '<fieldset class="ros_fieldset">', '<input type="checkbox">', '<span> Current</span><br/>', '<input type="radio" name="{section_item}" id="{id}_1">', '<span> Yes </span>', '<input type="radio" name="{section_item}" id="{id}_2">', '<span> No</span>', '</fieldset>', '</div>', '</div>', '</tpl>'),
        listeners: {
            click: function (dataView, index, node, e) {}
        }, id: 'soap-phyexam-center-rosall' + r.get('id'),
        autoHeight: true,
        itemSelector: 'div.ros-wrap-class',
        emptyText: 'No images to display'
    })
    i want to save my all values like textfield + checkbox + radio button everythin on onchange.

    Please help... Thanks in advance.

  2. #2
    Sencha User swarnendude's Avatar
    Join Date
    Jul 2009
    Location
    Kolkata, India
    Posts
    117

    Default

    Onchange of which field?
    Do you want to fire onchange event for all the fields?

    You can use dataview onClick event :

    Code:
    new Ext.DataView({
        onClick: function (e, el) {
            console.log(e, el);
        }, scope: this
    })

  3. #3
    Sencha User grgur's Avatar
    Join Date
    Aug 2007
    Location
    Split, Croatia
    Posts
    155

    Default

    please dont spam with your private messages
    <div style="float: left; width: 70px;">http://appac.us/mcs.png</div><div style="float: left; height: 100px;">Grgur Grisogono
    Ext JS in Action SE co-author
    Exercising awesomeness at Modus Create - Official Sencha Partner

    Get in touch for Sencha Touch Training
    @ggrgur</div><div style="clear:both;"></div>

  4. #4
    Sencha User
    Join Date
    Feb 2010
    Posts
    30

    Default

    No, not on onclick by that code i posted above i see multiple textboxes according to database records.
    I want, when i change the values in the textbox then i want to save the fields value.
    I think now you got my point.


    I need help to saving values of the textfields that is in dataview.

  5. #5
    Sencha User swarnendude's Avatar
    Join Date
    Jul 2009
    Location
    Kolkata, India
    Posts
    117

    Default

    Do one thing - put the whole template block inside a div like this:

    PHP Code:
    new Ext.XTemplate('<div id="container"><tpl for=".">', .... 
    Give the textfield inside the template a particular class like:

    HTML Code:
    <input type="text" class="my-textflds"/>
    Now access the textfields this way :

    PHP Code:
    var txtflds Ext.get('container').select('input.my-textflds'); 
    And for each textfields, create a listener :

    PHP Code:
    Ext.each(txtflds, function(fld){
        
    Ext.get(fld).on('change', function(e){
            
    console.log(Ext.get(fld).getValue());
        },
    this);
    }, 
    this); 
    Hope, this will help you.

  6. #6
    Sencha User
    Join Date
    Feb 2010
    Posts
    30

    Default

    Thanks swarnendude for your reply. Where i put this code
    var txtflds = Ext.get('container').select('input.my-textflds');
    and

    Ext.each(txtflds, function(fld){
    Ext.get(fld).on('change', function(e){
    console.log(Ext.get(fld).getValue());
    },this);
    }, this);
    please let me know.

  7. #7
    Sencha User swarnendude's Avatar
    Join Date
    Jul 2009
    Location
    Kolkata, India
    Posts
    117

    Default

    This should work only when those dataview elements are rendered properly. You can try executing them on Store load.

  8. #8
    Sencha User
    Join Date
    Feb 2010
    Posts
    30

    Default

    But the problem is the id goes same <div id="container"> container every time. This is the problem.

  9. #9
    Sencha User swarnendude's Avatar
    Join Date
    Jul 2009
    Location
    Kolkata, India
    Posts
    117

    Default

    PHP Code:
    new Ext.XTemplate('<div id="container"><tpl for=".">', .... 
    DIV is defined outside tpl. Check again.

  10. #10
    Sencha User
    Join Date
    Feb 2010
    Posts
    30

    Default

    No, This is not working for me.
    Give me some other solution.

Similar Threads

  1. DataView Drag Issue: After creating first Portlet into Portal from DataView
    By amitkrgarg in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Apr 2010, 1:24 PM
  2. DataView inside Form - load values from form load
    By SchattenMann in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 4 Jun 2009, 8:29 AM
  3. Form, saving and original values
    By thzero in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 30 May 2008, 1:27 PM
  4. Replies: 2
    Last Post: 28 Dec 2007, 1:46 AM

Posting Permissions

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