1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
    baran is on a distinguished road

      0  

    Question ExtJs working examples for Rails

    ExtJs working examples for Rails


    Hi All,
    I am new to Ext and have some difficulties for starting. I downloaded TreeGrid example and tried to run it locally but no success.
    PHP Code:
    Ext.onReady(function() {
        
    Ext.QuickTips.init();
        var 
    tree = new Ext.ux.tree.TreeGrid({
            
    title'my  tasks',
            
    width500,
            
    height300,
            
    renderToExt.getBody(),
            
    forceLayout true,
            
    enableDDfalse,
           
             
    columns:[{
                
    header'Task',
                
    dataIndex'task',
                
    width230
            
    },{
                
    header'Duration',
                
    width100,
                
    dataIndex'duration',
                
    align'center',
                
    sortType'asFloat',
                
    tpl: new Ext.XTemplate('{duration:this.formatHours}', {
                    
    formatHours: function(v) {
                        if(
    1) {
                            return 
    Math.round(60) + ' mins';
                        } else if (
    Math.floor(v) !== v) {
                            var 
    min Math.floor(v);
                            return 
    Math.floor(v) + 'h ' Math.round(min 60) + 'm';
                        } else {
                            return 
    ' hour' + (=== '' 's');
                        }
                    }
                })
            },{
                
    header'User',
                
    width150,
                
    dataIndex'user'
            
    }],
       
            
    //dataUrl: 'treegrid-data.json' that was originally. Even this does not work..
            
    dataUrl'/treegrid/getdata'
          

        
    }); 
    Even the commented line does not work.
    Code:
     //dataUrl: 'treegrid-data.json' that was originally. Even this does not work..
            dataUrl: '/treegrid/getdata'
    So this is the response but it does not bind any data!
    Code:
    {"Total":3,"Custs":[{"task":1,"duration":1.1,"user":"user1"},{"task":2,"duration":2.2,"user":"user2"},{"task":3,"duration":3.3,"user":"user3"}]}
    I will be really glad if somebody will point me to working examples with rails.
    Thanks in advance.

    Baran

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,169
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    If you aren't doing so, you need to run them through a web server.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
    baran is on a distinguished road

      0  

    Default


    Hi Evant,
    I use a webserver. WEBRick 1.3.1. Here is web server starting Output in NetBeans.
    Code:
    [2010-02-08 09:40:53] INFO  WEBrick 1.3.1
    [2010-02-08 09:40:53] INFO  ruby 1.8.7 (2008-08-11) [i386-mswin32]
    [2010-02-08 09:40:53] INFO  WEBrick::HTTPServer#start: pid=2916 port=3030
    Baran

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2009
    Posts
    3
    Vote Rating
    0
    sramazzina is on a distinguished road

      0  

    Default


    I normally wrote ExtJS code in Rails but I wasn't ever able to intermix ruby code with javascript code in .html.erb pages. So I'm used to generate the needed javascript inside appropriates helper methods.

    I hope this helps...

    S.

  5. #5
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
    baran is on a distinguished road

      0  

    Default


    Hi Sramazzina,
    Thanks for your response.
    I normally wrote ExtJS code in Rails but I wasn't ever able to intermix ruby code with javascript code in .html.erb pages. So I'm used to generate the needed javascript inside appropriates helper methods.
    Do you mean in myApp/helpers/myhelper.rb
    Could you give a simple Example please?

    Thanks
    Baran

  6. #6
    Sencha User
    Join Date
    Dec 2011
    Location
    Indonesia
    Posts
    2
    Vote Rating
    0
    kumakinsey is on a distinguished road

      0  

    Default working example of ExtJS + Rails + Devise + authorization

    working example of ExtJS + Rails + Devise + authorization


    Hello,

    I have made an example app to demonstrate integration between Rails and ExtJS (used Rails4 and Extjs 4.1.0), deployed @ heroku. For the authentication, I used Devise. For authorization, the_role ​gem is used.

    The app is located at teamsheet.herokuapp.com

    The source code + install instruction: https://github.com/weyewe/timesheet

    The app design: http://weyewe.com/rails-extjs-timesheet-tracker