1 Reply Latest reply on Aug 19, 2013 3:13 AM by Gerbrand Stap

    Webview.execute_js and showing 'progress' from controller to a view

    Fishroom App

      I am trying to figure out the best way to do the following:

       

      1) When my application starts I detect if it is the first time it is run, if so, navigate to the SystemSettings/FirstRun method, which will load into the RHOM a preloaded record set of 500+ items.

      2) When I am in SystemSettings traversing the JSON data set, I want to display progress back to the view so that the user can see that something is going on.

       

      So it is my understanding that the view is not available until after the corresponding method in the controller is executed so does this mean if I want to display status from my controller to the view, that I would have to hook into a load event inside the view and do a ajax call to the controller:

       

      SystemSettings controller:

      def index

         #do nothing

      end

       

      def FirstRun

         #do nothing

      end

       

      def dbProcessing

          #code to lookl through data insert into Rhom

          Webview.execute_js ('jsfunction to display status')

      end

       

      In firstRun.erb

      html to display progess and status

      js function to display status

      js function that gets executed on load to call

      $.get('/SystemSettings/dbProcessing')

       

      Is this the right way to do it? When I try the Webview.execute_js I get:

      Error: uninitialized constant SystemSettingsController::Webview