View Poll Results: If you read it, did you find DirectJNgine User's Guide adequate?

Voters
54. You may not vote on this poll
  • Yes

    40 74.07%
  • No

    14 25.93%
  1. #431
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default DirectJNgine 2.2 final is out

    DirectJNgine 2.2 final is out


    DirectJNgine 2.2 final is out.

    Here
    is an introduction to the new features in DJN 2.2.

    As always, you can download it here.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  2. #432
    Sencha User
    Join Date
    Jul 2012
    Posts
    5
    Vote Rating
    0
    n0n3 is on a distinguished road

      0  

    Default Trying to implement a paged grid panel

    Trying to implement a paged grid panel


    Hey again,
    I'm initializing the pageSize attributes for the Store and the PagingToolbar, the toolbar works good, but the gridpanel still shows all the records, not paged, any idea how to implement paging with directjngine ?
    If i want to just return the total record count and a subset, not querying the db for all the records at once?

  3. #433
    Sencha User
    Join Date
    May 2012
    Location
    Moline, Il
    Posts
    15
    Vote Rating
    0
    zachHurt is on a distinguished road

      0  

    Default


    Hey guys,

    I am having some trouble with directJNgine... I got the grid showing with extjs. I keep getting the error
    "No method registered as 'getResults' in action 'PartDatabase'"
    I have the java code below:
    Code:
    package com.softwarementors.extjs.djn.demo;
    
    
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    
    
    import com.softwarementors.extjs.djn.config.annotations.DirectMethod;
    import com.softwarementors.extjs.djn.servlet.ssm.ActionScope;
    import com.softwarementors.extjs.djn.servlet.ssm.Scope;
    @ActionScope(scope=Scope.APPLICATION)
    public class PartDatabase {
        //List<Part> items = new ArrayList<Part>();
      private static class Part {
        @SuppressWarnings("unused")
        public int id;
        @SuppressWarnings("unused")
        public String name;
        @SuppressWarnings("unused")
        public int size;
        @SuppressWarnings("unused")
        public String location;
        @SuppressWarnings("unused")
        public int cost;
        
        
        private Part( int id, String name, int size, String location, int cost) {
          this.id = id;
          this.name = name;
          this.size = size;
          this.location = location;
          this.cost = cost;
        }
      }
      List<Part> parts = new ArrayList<Part>();
      @DirectMethod
      public List<Part> djn_getResults() {
        
        Collections.addAll( parts,
          new Part( 0001, "cs345", 56, "waterloo", 1518),
          new Part( 0002, "cs346", 57, "india", 1251547),
          new Part( 0003, "cs347", 561, "waterloo", 1517),
          new Part( 0004, "cs346", 331, "moline", 1514),
          new Part( 0001, "cs345", 56, "waterloo", 1518),
          new Part( 0002, "cs346", 57, "india", 1251547),
          new Part( 0003, "cs347", 561, "waterloo", 1517),
          new Part( 0004, "cs346", 331, "moline", 1514),
          new Part( 0001, "cs345", 56, "waterloo", 1518),
          new Part( 0002, "cs346", 57, "india", 1251547),
          new Part( 0003, "cs347", 561, "waterloo", 1517),
          new Part( 0004, "cs346", 331, "moline", 1514),
          new Part( 0001, "cs345", 56, "waterloo", 1518),
          new Part( 0002, "cs346", 57, "india", 1251547),
          new Part( 0003, "cs347", 561, "waterloo", 1517),
          new Part( 0004, "cs346", 331, "moline", 1514)
        );
        
        return parts;
      }

    Yes, I did modify one of the examples

    below is my js code:
    Code:
    Ext.onReady(function() {    Ext.Direct.addProvider(Ext.app.REMOTING_API);
        
        Ext.define('PartInfo', {
            extend: 'Ext.data.Model',
            fields: [{name:'id',type:'int'}, 'name', 'size', 'location', 'cost'],
            proxy: {
                type: 'direct',
                api: {
                    //create:    QueryDatabase.createRecord,
                    read: PartDatabase.getResults,
                    //update:    QueryDatabase.updateRecords,
                    //destroy: QueryDatabase.destroyRecord
                }
            }
        });
        
        var store = Ext.create('Ext.data.Store', {
            model: 'PartInfo',
            autoLoad: true
        });
            
        var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
            clicksToMoveEditor: 1,
            autoCancel: false
        });
        
        // create the Grid
        var grid = Ext.create('Ext.grid.Panel', {
            height: 450,
            width: 700,
            cls: 'grid',
            title: 'Parts list',
            store: store,
            columns: [{
                dataIndex: 'id',
                width: 50,
                text: 'ID'
            }, {
                dataIndex: 'name',
                flex: 1,
                text: 'Name',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            }, {
                dataIndex: 'size',
                flex: 1.3,
                text: 'Size',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            },{
                dataIndex: 'location',
                flex: 1.3,
                text: 'Location',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            }, {
                dataIndex: 'cost',
                flex: 0.8,
                text: 'Cost',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false,
                    vtype: 'alphaSpace'
                }
            }],
            renderTo: Ext.getBody(),
            /*plugins: [
                rowEditing
            ],*/
            /*dockedItems: [{
                xtype: 'toolbar',
                dock: 'bottom',
                //creating, add items
                items: [{
                    iconCls: 'add',
                    text: 'Add',
                    handler: function() {
                        rowEditing.cancelEdit();
                        // create a blank record from PersonalInfo
                        var record = Ext.create('PartInfo');
                        //insert at top
                        store.insert(0, record);
                        //edit at row 0
                        rowEditing.startEdit(0, 0);
                    }
                }, {
                    iconCls: 'delete',
                    text: 'Delete',
                    handler: function() {
                        rowEditing.cancelEdit();
                        var sm = grid.getSelectionModel();
                        Ext.Msg.show({
                             title:'Delete Record?',
                             msg: 'You are deleting a record permanently, this cannot be undone. Proceed?',
                             buttons: Ext.Msg.YESNO,
                             icon: Ext.Msg.QUESTION,
                             fn: function(btn){
                                 if(btn === 'yes') {
                                     store.remove(sm.getSelection());
                                     store.sync();
                                 }
                             }
                        });
                    }
                }]
            }]
        });
        
        grid.on('edit', function(e) {
            console.log(e);
            e.context.record.save();
        });*/
    });
    });
    Finally for those concerned... this is a snippet of my web.xml file.
    Code:
      <init-param>
          <param-name>demo.classes</param-name>
          <param-value>
          com.softwarementors.extjs.djn.demo.Poll,
          com.softwarementors.extjs.djn.demo.TestAction,
          com.softwarementors.extjs.djn.demo.Profile,
          com.softwarementors.extjs.djn.demo.FormPostDemo,
          com.softwarementors.extjs.djn.demo.DirectStoreDemo,
          com.softwarementors.extjs.djn.demo.PartDatabase
          </param-value>
        </init-param>

  4. #434
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Just in case, try removing the "djn_" prefix from "djn_getResult".

    It is unneded, because you are already using the @DirectMethod annotation.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  5. #435
    Sencha User
    Join Date
    May 2012
    Location
    Moline, Il
    Posts
    15
    Vote Rating
    0
    zachHurt is on a distinguished road

      0  

    Default stuck with forum post

    stuck with forum post


    Hey guys I am trying to modify my previous post to be able to search within the grid. I have all crud functionality working! Unfortunately when I send the form data I get this error" Form post request is missing the following parameters: extAction, extMethod, extType, extTID, extUpload"

    I have my js code below
    Code:
    Ext.onReady(function() {    Ext.Direct.addProvider(Ext.app.REMOTING_API);
        
        Ext.define('PartInfo', {
            extend: 'Ext.data.Model',
            fields: [{name:'id',type:'int'}, 'name', 'size', 'location', 'cost'],
            proxy: {
                type: 'direct',
    			
                api: {
                    create: PartDatabase.addPart,
                    read: PartDatabase.getResults,
                    update: PartDatabase.updatePart,
                    destroy:PartDatabase.removePart
                }
            }
        });
         var store = Ext.create('Ext.data.Store', {
            model: 'PartInfo',
            autoLoad: true
        });
            
    	var basicInfo = Ext.create('Ext.form.Panel', {
            // configs for FormPanel
            title: 'Search by ID',
            border: false,
            bodyPadding: 10,
            // configs for BasicForm
            api: {
                // The server-side method to call for load() requests
               // load: Profile.getBasicInfo,
                // The server-side must mark the submit handler as a 'formHandler'
               submit: Handler.search
            },
            // specify the order for the passed params
            paramOrder: ['id', 'name'],
    		//paramsAsHash: true,
    		formHandler: true,
            dockedItems: [{
                dock: 'bottom',
                xtype: 'toolbar',
                ui: 'footer',
                style: 'margin: 0 5px 5px 0;',
    			paramsAsHash: false,
                items: ['->', {
                    text: 'Submit',
                    handler: function(){
    					
    						
                       console.log(basicInfo.getForm());
                       var parts = basicInfo.getForm().submit({
                            params: {
    							foo: 'bar',
    							uid: 34
                            }
    						
                        });
    					
    					store.load();
    					//store.update();
                    }      
                }]
            }],
            defaultType: 'textfield',
            defaults: {
                anchor: '100%'
            },
            items: [{
                fieldLabel: 'ID',
                name: 'id'
            },
    		{fieldLabel: 'Name',
                name: 'name'
    		}]
        });
    	
       
            
        var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
            clicksToMoveEditor: 1,
            autoCancel: false
        });
        
        // create the Grid
        var grid = Ext.create('Ext.grid.Panel', {
            height: 450,
            width: 700,
            cls: 'grid',
            title: 'Parts list',
            store: store,
            columns: [{
                dataIndex: 'id',
                width: 50,
                text: 'ID'
            }, {
                dataIndex: 'name',
                flex: 1,
                text: 'Name',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            }, {
                dataIndex: 'size',
                flex: 1.3,
                text: 'Size',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            },{
                dataIndex: 'location',
                flex: 1.3,
                text: 'Location',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                }
            }, {
                dataIndex: 'cost',
                flex: 0.8,
                text: 'Cost',
                allowBlank: false,
                field: {
                    type: 'textfield',
                    allowBlank: false
                   // vtype: 'alphaSpace'
                }
            }],
            renderTo: Ext.getBody(),
            plugins: [
                rowEditing
            ],
            dockedItems: [{
                xtype: 'toolbar',
                dock: 'bottom',
                //creating, add items
                items: [{
                    iconCls: 'add',
                    text: 'Add',
                    handler: function() {
                        rowEditing.cancelEdit();
                        // create a blank record from PersonalInfo
                        var record = Ext.create('PartInfo');
                        //insert at top
                        store.insert(0, record);
                        //edit at row 0
                        rowEditing.startEdit(0, 0);
    					//store.load();
    					}}, 
    					{
                    iconCls: 'delete',
                    text: 'Delete',
                    handler: function() {
                        rowEditing.cancelEdit();
                        var sm = grid.getSelectionModel();
                        Ext.Msg.show({
                             title:'Delete Record?',
                             msg: 'You are deleting a record permanently, this cannot be undone. Proceed?',
                             buttons: Ext.Msg.YESNO,
                             icon: Ext.Msg.QUESTION,
                             fn: function(btn){
                                 if(btn === 'yes') {
                                     store.remove(sm.getSelection());
                                     store.sync();
                                 }
                             }
                        });
                    }
                }, basicInfo]
            }]
        });
        
        grid.on('edit', function(e) {
            console.log(e);
            e.context.record.save();
    		//store.load();
    		store.update();
    		store.load();
        });
    });
    and this is my java code (I am using a list as my data structure considering this is simply a proof of concept):
    Code:
    package com.softwarementors.extjs.djn.demo;
    
    
    import java.util.*;
    
    
    import org.apache.commons.fileupload.FileItem;
    
    
    
    
    
    
    import com.softwarementors.extjs.djn.config.annotations.DirectFormPostMethod;
    import com.softwarementors.extjs.djn.config.annotations.DirectMethod;
    import com.softwarementors.extjs.djn.servlet.ssm.ActionScope;
    import com.softwarementors.extjs.djn.servlet.ssm.Scope;
    @ActionScope(scope=Scope.APPLICATION)
    public class Handler {
    
    
    	 @DirectFormPostMethod
    	  public void search(Map<String, String> formParameters, Map<String, FileItem> fileFields){
    		  assert formParameters != null;
    		  assert fileFields != null;
    		  String id = formParameters.get("id");
    		  System.out.println(id);
    		  //base = "10";
    		  PartDatabase.Part temp= new PartDatabase.Part( 16, "cs346", 31, "harvester", 1525);
    		/*for(int i=0; i<parts.size(); i++){
    		  		if(parts.get(i).id == Integer.parseInt(base))
    		  			temp= parts.get(i);
    		  	}*/
    		// parts.clear();
    		 PartDatabase.parts.clear();
    		 PartDatabase.parts.add(temp);
    	  }
    }

  6. #436
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Hi!

    The missing data you mention is automatically added by ExtJs when calling a direct method. This means you are no getting the ExtJs direct mechanism + submit working propertly. This problem is not DJN-related, you need to make sure the client side is well configured and working first.

    I would start from a minimalist working example for submit, and then add DJN to the equation step by step. There is a working form submit example in DJN: read the User's Guide and check the example application.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  7. #437
    Sencha User
    Join Date
    May 2012
    Location
    Moline, Il
    Posts
    15
    Vote Rating
    0
    zachHurt is on a distinguished road

      0  

    Default


    Could this be a problem because my model associated with my grid already has an api associated with it?

  8. #438
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    I'm not sure what you are trying to do, but I don't think that should interfere.

    Now, *IF* you are using a form to add filtering, you should not be calling submit, but rather you should call your read method (you already specified it via the api, I think) making sure you pass the filter parameters you have entered in your form to that method, and use them to return the right data.

    And, of course, you should define the server read method to receive additional filtering data. If you set logging support in DJN appropriately you will be able to see what the hell Extjs is sending to the server, and that can help you ascertain what the server method should look like.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  9. #439
    Sencha User
    Join Date
    May 2012
    Location
    Moline, Il
    Posts
    15
    Vote Rating
    0
    zachHurt is on a distinguished road

      0  

    Default


    How do I set the logging support or view what was being sent to the server? I went into my ext-all-debug.js and did a console.log() and this is what was being sent to the server: extTID=3&extAction=Handler&extMethod=search&extType=rpc&extUpload=false&foo=bar&uid=34&name=Aaron%20Conran&email=aaron%40extjs.com&company=Ext%20JS%2C%20LLC

    when I edited in the example provided in the resource guide. I am not really sure where to go from here. I am only working on a proof of concept and I am not sure how to send the data received from the form to filter the grid like you say I can.

  10. #440
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    ExtJs can be *complex*, more so because demos and examples just go so far. You should take a look at ExtJs example with remote filtering (there is one) to get you started.

    It might be a good idea for you to see how to pass extra parameters when loading data with a store: Google and the ExtJs help system are your friends.

    And it would be good for you to read the latest DJN User's Guide to get an idea on how to get DJN logging working, etc., which can be really good to see what's going on.

    When it comes to learning ExtJs, you should probably do every little thing in isolation: filtering, sorting, CRUD... Make every thing workd in isolation, and combine later. Else, it will be hell. Try filtering without messing with CRUD.

    Good luck!
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

Thread Participants: 86

  1. Animal (5 Posts)
  2. barton (4 Posts)
  3. Condor (1 Post)
  4. mauro_monti (6 Posts)
  5. mbarto (1 Post)
  6. aconran (1 Post)
  7. MoShAn480 (1 Post)
  8. asgillett (2 Posts)
  9. seade (4 Posts)
  10. zaqwsxqwer (3 Posts)
  11. Sesshomurai (16 Posts)
  12. ThierryC (3 Posts)
  13. maxm165 (3 Posts)
  14. techstudios (2 Posts)
  15. sayonara (2 Posts)
  16. kschlaudt (1 Post)
  17. hschaefer123 (2 Posts)
  18. omarc (2 Posts)
  19. lxbzmy (4 Posts)
  20. mct (6 Posts)
  21. mediacept (2 Posts)
  22. dionisexorcius (1 Post)
  23. alper (1 Post)
  24. steverc (2 Posts)
  25. chrizmaster (18 Posts)
  26. J@y (21 Posts)
  27. Georgioa (6 Posts)
  28. wguan (1 Post)
  29. minneyar (16 Posts)
  30. jhoweaa (1 Post)
  31. Ramez (2 Posts)
  32. malus (1 Post)
  33. dweller (8 Posts)
  34. stdunbar (1 Post)
  35. vlagorce (20 Posts)
  36. cwilliso (1 Post)
  37. Whatty (13 Posts)
  38. Ice (1 Post)
  39. clynnh (1 Post)
  40. SreevaniN (1 Post)
  41. Stsalomon90 (1 Post)
  42. GregT (9 Posts)
  43. jcalfee (6 Posts)
  44. set_ti (1 Post)
  45. maho2nd (3 Posts)
  46. dreamtaotao (3 Posts)
  47. Toxa (4 Posts)
  48. tungchau (3 Posts)
  49. wlan0 (2 Posts)
  50. jpr (2 Posts)
  51. gianmarco (5 Posts)
  52. extjslikeit (2 Posts)
  53. harmen_wessels (1 Post)
  54. Olivercomputing2 (4 Posts)
  55. vanessa_ng (2 Posts)
  56. alois.cochard (5 Posts)
  57. kyrillos52 (2 Posts)
  58. Tod (1 Post)
  59. Alinanila (1 Post)
  60. tfannon (2 Posts)
  61. Kynao (1 Post)
  62. feiq (4 Posts)
  63. dalt (1 Post)
  64. xfolch (1 Post)
  65. avijit (1 Post)
  66. marcelsnews (2 Posts)
  67. maddhippy (1 Post)
  68. sritter (1 Post)
  69. july (2 Posts)
  70. jtkeller7983 (1 Post)
  71. lfranchini (2 Posts)
  72. 7/11 (2 Posts)
  73. yAdEs (1 Post)
  74. zazz (1 Post)
  75. waqar (5 Posts)
  76. pjain11 (1 Post)
  77. alexMobimesh (2 Posts)
  78. zachHurt (4 Posts)
  79. n0n3 (5 Posts)
  80. adavis2 (1 Post)
  81. mark.peters (1 Post)
  82. lee el (4 Posts)
  83. frengo19 (3 Posts)
  84. prakashwagle (1 Post)
  85. extejnar (2 Posts)
  86. alin@sonatype.com (1 Post)