Results 1 to 2 of 2

Thread: Value from textarea to JSON

  1. #1
    Sencha User
    Join Date
    Dec 2013
    Posts
    65
    Answers
    2

    Default Answered: Value from textarea to JSON

    hello i have a form with grid (id, year, author) and a child form with TEXTAREA (there enter name of author ) and button and JSON
    PHP Code:
    json={"bookId":1,"author":"2","options":[{"author":"NAME","value":"3"},{"author":"american","value":"4"}]} 
    and i want: on click button text in textarea send to my JSON on "NAME".

    PHP Code:
    authorBook: function(button) {
            var 
    win button.up('window');     
            var 
    grid win.getGrid();       
            var 
    rowIndex win.getRowIndex();    
            
    store grid.store;      
            var 
    agrid.getStore().getAt(rowIndex);     
            var 
    request = { 
    what i write on request ? thanks

  2. Use Ext.merge()

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function() {
    
            var extjs = {
                companyName: 'Ext JS',
                products: ['Ext JS', 'Ext GWT', 'Ext Designer'],
                isSuperCool: true,
                office: {
                    size: 2000,
                    location: 'Palo Alto',
                    isFun: true
                }
            };
    
            console.log(Ext.encode(extjs));
            
            var newStuff = {
                companyName: 'Sencha Inc.',
                products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
                office: {
                    size: 40000,
                    location: 'Redwood City'
                }
            };        
            
            var sencha = Ext.Object.merge(extjs, newStuff);
            
            console.log(Ext.encode(extjs));
            
        }
    });

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Use Ext.merge()

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function() {
    
            var extjs = {
                companyName: 'Ext JS',
                products: ['Ext JS', 'Ext GWT', 'Ext Designer'],
                isSuperCool: true,
                office: {
                    size: 2000,
                    location: 'Palo Alto',
                    isFun: true
                }
            };
    
            console.log(Ext.encode(extjs));
            
            var newStuff = {
                companyName: 'Sencha Inc.',
                products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
                office: {
                    size: 40000,
                    location: 'Redwood City'
                }
            };        
            
            var sencha = Ext.Object.merge(extjs, newStuff);
            
            console.log(Ext.encode(extjs));
            
        }
    });

Posting Permissions

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