1. #21
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Quote Originally Posted by JamesC View Post
    Funny you should say that I just bought a new microsoft wireless keyboard and mouse combo and as you say they certainly can make mice/keyboards.
    Yeah, I liked these combos/sets most. Especially good was that "ergonomic" keyboard. I don't know if they still produce it - I use notebook now. (HP/Compaq is my favorite brand.)
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  2. #22
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Saki, I went exploring a bit for educational purposes and have a couple of questions, although my questions appear unrelated to the actual plugin, more about your grid extension implementation. Hopefully ok to post in this thread for these questions.


    PHP Code:
    Example.Grid1 Ext.extend(Ext.grid.EditorGridPanel, {
         
    layout:'fit'
        
    ,border:false
        
    ,stateful:false
        
    ,url:'process-request.php'
        
    ,objName:'company'
        
    ,idName:'compID' 
    What are you doing with objName and idName?

    It looks like you're going to use objName server side.

    PHP Code:
                    ,baseParams:{cmd:'getData'objName:this.objName
    So I gather you've sent directions to route you to the appropriate controller ('cmd') but then I couldn't guess what you're going to do with the objName.

    As for idName, I didn't really understand much for that one:
    PHP Code:
            switch(options.params.cmd) {
                case 
    'saveData':
                    var 
    records this.store.getModifiedRecords();
                    
    Ext.each(records, function(ri) {
                        if(
    o.insertIds && o.insertIds[i]) {
                            
    r.set(this.idNameo.insertIds[i]);
                            
    delete(r.data.newRecord);
                        }
                    });
                    
    this.store.commitChanges();
                break; 
    I gather you've sent back from server side a json property insertIds, but I don't quite get the set and delete parts.

  3. #23
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Here you are MJ,

    cmd stands, as you already understand, for a command to execute. It can be something like: getData, saveData, deleteRecord, or any command your server script understands.

    objName stands for an "object" that we want to execute the command with. There is also server-side script included in the download so you can study it in full, but here is an excerpt:
    PHP Code:
    $objects = array(
        
    // {{{
        // company
        
    "company"=>array(
             
    "table"=>"company"
            
    ,"idName"=>"compID"
            
    ,"fields"=>array(
                 
    "compID"
                
    ,"company"
                
    ,"price"
                
    ,"change"
                
    ,"pctChange"
                
    ,"lastChange"
                
    ,"industry"
                
    ,"action1"
                
    ,"qtip1"
                
    ,"action2"
                
    ,"qtip2"
                
    ,"action3"
                
    ,"qtip3"
                
    ,"note"
            
    )
        )
        
    // }}}
    ); 
    In a multi-table environment we should know which fields we have, what is the table name, etc. Therefore, if I send objName:'company' server looks in the above table and has all necessary data available.

    idName is forgotten in client sources in fact as a remain of devel process and it is name of the field in a table that holds primary key. In our case it would be compID. This is important as if you send {cmd:'deleteRecord', objName:'company', id:33} we need to create an sql so we need id-to-primary-key mapping.

    Should you have more questions, just post here, no problem.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  4. #24
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Aaah, one more,

    my server-side script can insert new records or update old ones in one request. You can edit grid records, add new ones and the click save and all works.

    It is done such a way, that new records get property newRecord:true so server knows where to use update sql and where to use insert sql.

    insertIds is array of primary key values of newly inserted records that client receives as the response from server so it can update underlying records in the store by removing newRecord property and setting correct ids for them. Otherwise you wouldn't be able to delete newly inserted records jus after clicking Save (Submit) as you wouldn't have ids to send to server for the delete command. Also update would fail or, better to say, it wouldn't update as id would be null (for those new records) so update sql wouldn't find any matching records.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  5. #25
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    My mistake, I didn't realize (or forgot probably because I think you mentioned somewhere) that php script was included. I'll look further at the php file in the zip (I was just poking around the js in firebug initially).

    I'm with you on the explanation. I had already been using a primaryKey property similar to your idName, so I'm with you there. I had also been passing a table property as well, but I think your method may be a more powerful way to approach it, I'll dig around some more....


    Aaah, one more,

    my server-side script can insert new records or update old ones in one request. You can edit grid records, add new ones and the click save and all works.

    It is done such a way, that new records get property newRecord:true so server knows where to use update sql and where to use insert sql.
    I'm going to review this bit further. At the moment I'm playing with having a save button on the toolbar. There is also a preferences menu button on the toolbar where you can select the save mode preference (instant, manual or when leaving a row). The save button enables/disables depending on the save mode. Anyway, batching up the client side data to send to the server depends a bit on the saveMode.

    I was originally using a similar newRecord property. But I have changed that to sending the recordID. In the config I set newKey: -1. When a new record is added client side it is assigned the current value of newKey and then then newKey is decremented by one in case another record is added. Server side, I check if the value of the recordID is less than 1, if it is I do an insert, otherwise I use the update sql. I have this complexity in there because a user can add multiple records before "saving". So this way each added record has a unique record id.
    Similar to what you mention below, once the server returns the response I can update new records to have the actual database primaryKey value instead of the negative number it got initially.

    insertIds is array of primary key values of newly inserted records that client receives as the response from server so it can update underlying records in the store by removing newRecord property and setting correct ids for them. Otherwise you wouldn't be able to delete newly inserted records jus after clicking Save (Submit) as you wouldn't have ids to send to server for the delete command. Also update would fail or, better to say, it wouldn't update as id would be null (for those new records) so update sql wouldn't find any matching records.
    I'm not sure if I have a problem like you elude to here. So far I haven't been able to break it. But I'm not sure if I'm in "save instantly" saveMode if someone can modify a newly created record fast enough where there may be some moment when there's a cross in communication before the new record gets it's "real primary key" assigned.

  6. #26
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Yeah, these are 2 workable approaches to one problem. I usually don't use instant save so returning real insertIds is vital.

    I like your "fake negative" id as you can identify records safely. I rely on the order assuming that submitted records have some order and insertIds have same order. This method works reliably too though.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  7. #27
    Ext User
    Join Date
    May 2007
    Posts
    27
    Vote Rating
    0
    oracio is on a distinguished road

      0  

    Default


    hello Saki,

    This extension is exactly what i was looking for, so thanks a lot!
    I understand that it is still in an early beta version, but just for you knowledge, it doesnt work well on IE7: the Add Recrod doesnt work and when i open the edit record and save it, the page stucks.

    Anyways, i just wanted to inform you about those issues and for your question if you should keep working on this extantion, in my opinion. Y-E-S!

  8. #28
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Add button is not a part of the extension, it's part of the demo application. I haven't had time to implement it yet. I'll take a look at the another issue in IE7.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  9. #29
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    I've done add record - check it out now.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  10. #30

Thread Participants: 97

  1. franklt69 (1 Post)
  2. Wolfgang (1 Post)
  3. mystix (1 Post)
  4. cobnet (8 Posts)
  5. chiphi13 (4 Posts)
  6. mike1993 (1 Post)
  7. violinista (1 Post)
  8. hui2008 (4 Posts)
  9. AlxH (12 Posts)
  10. oracio (1 Post)
  11. CINUE (2 Posts)
  12. phpcoder (3 Posts)
  13. ostghost (2 Posts)
  14. tdikarim (4 Posts)
  15. lkasdorf (3 Posts)
  16. derf (1 Post)
  17. mjlecomte (11 Posts)
  18. farracha (1 Post)
  19. jcwatson11 (2 Posts)
  20. robin30 (8 Posts)
  21. bluesapphire (1 Post)
  22. wm003 (1 Post)
  23. divxer (1 Post)
  24. escalade (2 Posts)
  25. boonkerz (5 Posts)
  26. JamesC (2 Posts)
  27. neenhouse (5 Posts)
  28. mask_hot (18 Posts)
  29. concep86 (2 Posts)
  30. sinma (2 Posts)
  31. kai5263499 (2 Posts)
  32. jcmartinez (1 Post)
  33. trak (1 Post)
  34. amit.shukld (1 Post)
  35. hsurya (1 Post)
  36. richgoldmd (1 Post)
  37. loic (7 Posts)
  38. jimpa911 (1 Post)
  39. chalu (3 Posts)
  40. damian79 (1 Post)
  41. jimkan (6 Posts)
  42. jahong (7 Posts)
  43. winnel (1 Post)
  44. joku (1 Post)
  45. josephf (2 Posts)
  46. indrajit_bin_rahwana (4 Posts)
  47. nojutsu (2 Posts)
  48. pokerking400 (15 Posts)
  49. georgiosleon (2 Posts)
  50. snilson (2 Posts)
  51. nightowl (1 Post)
  52. gthe (1 Post)
  53. descheret (1 Post)
  54. nebbian (2 Posts)
  55. se7en.hu (1 Post)
  56. towanime (2 Posts)
  57. pravidya (4 Posts)
  58. cnagel (2 Posts)
  59. extnam01 (2 Posts)
  60. Rothariger (6 Posts)
  61. dsmaevich (1 Post)
  62. uidtest (2 Posts)
  63. savant (4 Posts)
  64. aserron (1 Post)
  65. skaue (1 Post)
  66. ielektronick (1 Post)
  67. kalpan (4 Posts)
  68. jasonb885 (2 Posts)
  69. wemerson.januario (1 Post)
  70. extjs_new (23 Posts)
  71. Dumas (24 Posts)
  72. m.natarajan (1 Post)
  73. MrEnirO (4 Posts)
  74. jove76 (2 Posts)
  75. CircleCode (3 Posts)
  76. mdimino (7 Posts)
  77. flinz (2 Posts)
  78. vince (2 Posts)
  79. jmaldini (5 Posts)
  80. mixer80 (1 Post)
  81. prox00 (1 Post)
  82. macdoug1 (14 Posts)
  83. return1.at (8 Posts)
  84. islabucasgrande (1 Post)
  85. big (1 Post)
  86. NicP (9 Posts)
  87. taron133 (1 Post)
  88. araiczyk (1 Post)
  89. adhoul (1 Post)
  90. mayurid (9 Posts)
  91. Kalpit (10 Posts)
  92. bizcatalyst (1 Post)
  93. Manuelbond007 (2 Posts)
  94. nasargus (1 Post)
  95. shahab_et (1 Post)
  96. stevwinata (5 Posts)
  97. tomdchi (2 Posts)