Page 10 of 60 FirstFirst ... 8910111220 ... LastLast
Results 91 to 100 of 591

Thread: Grid RecordForm Plugin

  1. #91
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
      0  

    Default thanks

    thank you for your quick reply, really appreciate it.

    i understand what you mean. Gonna try to figure out how the save button works.

    Keep up the good work, thanks for taking your time helping me. really appreciate it.

  2. #92
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
      0  

    Default trying the save button

    hi all,

    i'm trying to do the save button but i can't seem to get it to work.

    i can change fields, press ok, little red triangle appears but as soon as i click on save a little window shows up and it says "Unknown Error".

    i have apache server + mysql
    objName = bills (i assume this is the table name in my database)
    idName = id (i assume this is the primairy key in my table)
    url='php/database.php'
    cmd='update'

    in my database.php i do have a function called 'update' this is what it looks like:
    PHP Code:
    function update()
    {
        
    $id $_GET['id'];
        
    $name $_POST['name'];
        
    $due $_POST['due'];
       
    $amount $_POST['amount'];
        
    $paid $_POST['paid'];
        
    $paid_when $_POST['paid_when'];
       
    $amount_paid $_POST['amount_paid'];
    if (
    $paid == 'true'){
    $paid '1';
    } else {
    $paid '0';
    }
       
    $result="SELECT * FROM bills where id='$id'";
    $result1=mysql_query($result);
    $rows mysql_fetch_array($result1);
    $amount $rows['amount'];
    $difference $amount_paid $amount;
       
        
    $query "UPDATE bills SET name = '$name', due='$due', amount='$amount', paid='$paid', paid_when='$paid_when', amount_paid='$amount_paid', difference='$difference' WHERE id=$id";
        
    $result3 mysql_query($query);
        echo 
    '1';

    i'm pretty sure here's where i go wrong. can someone please tell me what i'm doing wrong and give a kick in my rearend to the right direction i have to go to make this work?

    thanks,

    regards,

    Robin30

  3. #93
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
      0  

    Default

    firebug is giving me at least something,lol

    PHP Code:
    cmd  update
    data    
    [{"name":"Penele","id":"53"}]
    objName    bills 
    i changed the name of id # 53 so that is correct, but still don't know how to get it changed in my database.

    regards,
    robin30

  4. #94
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    Take php from demo page and adjust it. In each step test when it stops to work. BTW, I'd use PDO if possible - saves a lot of headaches.
    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


  5. #95
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
      0  

    Exclamation totally lost

    i looked at the php file,

    i'm using the same files as you do, Saki, now i get a message date or idname missing.

    i'm loosing really sleep over this, .

    i do have a different setup for the grid as you, if i use for example this.idName firefox goes ballastic.

    so i made var out if it all.

    this is my code for the grid:
    PHP Code:
    var grid = new Ext.grid.EditorGridPanel({
        
    id:'lol',
                
    enableColLock:false,
                
    url:'php/database.php',
        
    objName:'bills',
        
    idName:'id',
            
    // sm: new Ext.grid.RowSelectionModel({singlerow:true}),
            
    width:700,
                
    height:500,
            
    dsstore,
                
    cmcm
                
    sm:sm,
                
    plugins: [summaryaction, new Ext.ux.grid.Search({
                    
    iconCls:'icon-zoom'
                    
    ,readonlyIndexes:['all']
                    ,
    disableIndexes:['amount'],
                    
    mode:'local',
                    
    position:'top',
                    
    align:'right'
                
    }), recordForm],
        
    trackMouseOver:false,
            
    loadMasktrue,
            
    frame:false,
            
    viewConfig: {
                
    forceFit:true
            
    },

    bbar: new Ext.PagingToolbar({
                    
    pageSize15,
                    
    storestore,
                    
    displayInfotrue
                
    }),
                
    buttons:[{
                     
    text:'Save'
                    
    ,iconCls:'icon-disk'
                    
    ,scope:this
                    
    ,handlercommitChanges
                
    },{
                     
    text:'Reset'
                    
    ,iconCls:'icon-undo'
                    
    ,scope:this
                    
    ,handler:function() {
                        
    this.store.rejectChanges();
                    }
                }],
         
    tbar:[{
             
    text'Add Bill',
            
    iconCls:'add',
        
    tooltip'Add Bill',
        
    handleraddbillform
            
    },'-',{
            
    text'Delete Bill(s)',
            
    iconCls:'remove',
    tooltip'Delete Selected Bill',
            
    handler:     deleteContextMenu    
    }
    //,'-',{
    //        text: 'Pay Bill',
     //       iconCls:'money',
    //tooltip: 'Pay Selected Bill',
    //        handler: paidbillform
    //}
    ,'-']
            });
            
            
            
    ListingContextMenu = new Ext.menu.Menu({
          
    id'ListingEditorGridContextMenu',
          
    items: [
          { 
    text'Pay Bill'iconCls:'money'handlerpaidbillform },
          { 
    text'Add Bill'iconCls:'add'handleraddbillform },
          { 
    text'Delete Bill'iconCls:'remove'handlerdeleteContextMenu }
        
    //  ,'-',
        //  { text: 'Print this grid', iconCls:'printer', handler: printListingContextMenu }
          
    ]
       }); 
      
    grid.addListener('rowcontextmenu'onListingEditorGridContextMenu); 
    the commitChanges i did put in a var too:

    PHP Code:
    var commitChanges = function() {
            var 
    records store.getModifiedRecords();
            if(!
    records.length) {
                return;
            }
            var 
    data = [];
            
    Ext.each(records, function(ri) {
                var 
    r.getChanges();
                if(
    r.data.newRecord) {
                    
    o.newRecord true;
                }
                
    o[idName] = r.get('id');
                
    data.push(o);
            });
            var 
    = {
                 
    url:'php/modified.php'
                
    ,method:'post'
                
    ,callback:requestCallback
                
    ,params:{
                     
    cmd:'saveData'
                    
    ,objName:'bills'
                    
    ,data:Ext.encode(data)
                }
            };
            
    Ext.Ajax.request(o);
        } 
    // eo function commitChanges

        
    var requestCallback = function(optionssuccessresponse) {
            if(
    true !== success) {
                
    this.showError(response.responseText);
                return;
            }
            try {
                var 
    Ext.decode(response.responseText);
            }
            catch(
    e) {
                
    this.showError(response.responseText'Cannot decode JSON object');
                return;
            }
            if(
    true !== o.success) {
                
    this.showError(o.error || 'Unknown error');
                return;
            }

            switch(
    options.params.cmd) {
                case 
    'saveData':
                    var 
    records store.getModifiedRecords();
                    
    Ext.each(records, function(ri) {
                        if(
    o.insertIds && o.insertIds[i]) {
                            
    r.set('id'o.insertIds[i]);
                            
    delete(r.data.newRecord);
                        }
                    });
                    
    store.commitChanges();
                break;

                case 
    'deleteData':
                break;
            }
        } 
    // eo function requestCallback

        
    var showError = function(msgtitle) {
            
    Ext.Msg.show({
                 
    title:title || 'Error'
                
    ,msg:Ext.util.Format.ellipsis(msg2000)
                ,
    icon:Ext.Msg.ERROR
                
    ,buttons:Ext.Msg.OK
                
    ,minWidth:1200 String(msg).length 360 600
            
    });
        } 
    because this.idName and this.objName didn't/doesn't work with me i please it all with

    'id' and 'bills'


    this is my php file:
    [PHP]<?
    // vim: ts=4w=4:nu:fdc=4:nospell

    require("csql.php");

    if(!isset($_POST["cmd"])) {
    return;
    }

    $objects = array(
    // {{{
    // company
    "bills"=>array(
    "table"=>"bills"
    ,"idName"=>"id"
    ,"fields"=>array(
    "id"
    ,"name"
    ,"due"
    ,"amount"
    ,"paid"
    ,"paid_when"
    ,"amount_paid"
    ,"difference"

    )
    )
    // }}}
    );

    // create PDO object and execute command
    $osql = new csql();
    $_POST["cmd"]($osql);

    // command processors
    // {{{
    /**
    * getData: Outputs data to client
    *
    * @author Ing. Jozef Sak

  6. #96
    Ext User
    Join Date
    Mar 2008
    Posts
    60
    Vote Rating
    1
      0  

    Default

    I just played with the demo @ http://recordform.extjs.eu/ .
    It looks good!

    When I added a record via the regular add and then tried to delete it without entering any data into it, I couldn't delete it.

  7. #97
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    Delete is not implemented, anyway it is not part of the plugin.
    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


  8. #98
    Sencha User
    Join Date
    May 2007
    Location
    Germany
    Posts
    84
    Vote Rating
    1
      0  

    Default

    I had a small issue when destroying and recreating the recordform object.
    It took me hours to find out what is causing it. The following seems to fix it:
    Replace
    Code:
    var config = Ext.apply(this.defaultWindowConfig, this.windowConfig);
    With
    Code:
     var config={};
     Ext.apply(config,this.defaultWindowConfig);
     Ext.apply(config, this.windowConfig);
    in the show-function.

  9. #99
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    What could be the reason? Any references to defaultWindow config that get overridden? Or you supply defaultWindowConfig? Or you re-use defaultWindowConfig?
    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


  10. #100
    Sencha User
    Join Date
    May 2007
    Location
    Germany
    Posts
    84
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by jsakalos View Post
    What could be the reason? Any references to defaultWindow config that get overridden? Or you supply defaultWindowConfig? Or you re-use defaultWindowConfig?
    Im not that deep into javascript. Could it be possible, that the defaultWindowConfig property is treated as class-property so that it is reused in the following instanciations? That would explain the strange behaviour, because you use an "applyIf" to assign the form item and listeners.
    The effect I observed, was that on the second instance in the listeners the form and window properties where null.

Page 10 of 60 FirstFirst ... 8910111220 ... LastLast

Posting Permissions

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