1 Reply Latest reply on Mar 13, 2012 9:30 AM by Hector Meza

    Rhodes-Problem in executing methods from the native extension.

      Hi,

       

      I created new rhodes application in rhostudio and added a native extension by executing the command "rhogen extension ext"

       

      Then I got two folders created inside my project.

      ExTest\app\ExtTest

      ExTest\extensions\ex

       


      in the index.erb inside the app folder I added a link to the ExtTest like this.

      <div data-role="content">

          <ul data-role="listview">

            <li><a href="ExtTest">ExtTest</a></li>

          </ul>

        </div>

       

       

      When I run the app and click this link index.erb inside the ExtTest folder is loaded.
      This is the code of that file.

       

      <div data-role="page">0

        <div data-role="header" data-position="inline">

          <h1>Ext Extension Test</h1>

          <a href="<%= Rho::RhoConfig.start_path %>" class="ui-btn-left" data-icon="home" data-direction="reverse"

        </div>

        <div data-role="content">

          <ul data-role="listview">

              <%= link_to 'Run Ext test', { :action => :run_test }%>

          </ul>

        </div>

      </div>

       

       

      run_test is a method in exttest_controller.rb inside the ExtTest folder.

       

      require 'rho/rhocontroller'

      require 'helpers/application_helper'

      require 'helpers/browser_helper'

      require 'ext'

       

       

      class ExtTestController < Rho::RhoController

        include BrowserHelper

        include ApplicationHelper

       

        def index

          render :back => '/app'

        end

       

       

        def run_test

          sum = Ext.calc_summ(3,7)

          Alert.show_popup Ext::ExtStringHelper::process_string('test')+sum.to_s

          render :action => :index, :back => '/app'

        end

       

      end

       

      When I click the link "Run Ext test" the method run_test is not invoked.

      http://127.0.0.1:49975/app/ExtTest/run_test

      This URL seems to be broken.

      And I can't find out a reason for this error. Can anybody help me on this issue?

        • Re: Rhodes-Problem in executing methods from the native extension.
          Hector Meza

          Asanka, I had a similar issue and found that I was not hitting the correct controller method -

           

          I added a reference to the controller I wanted to call i.e.

          <li><a href=",%= url_for :controller => :Model_name_were_controller_is_located , :action => :method_name%> Label-name,/a></li>

           

          I also changed to log level to 0 in the rhoconfig.txt (rhodes log property) which added the additional tracing in the console dialog - helped me see where the app was at.

           

          Hope this helps: