                 js_error: js_error is true
             return @
 
+        set_query_result: ({query_result}) =>
+            @query_result.discard()
+            @query_result = query_result
+            # ATN disable "next" button
+            if query_result.ready
+                @render()
+                @new_view()
+            else
+                @query_result.on 'ready', () =>
+                    @render()
+                    @new_view()
+
+        render: (args) =>
+            # ATN many of these fields don't get updated when their value changes
+            if @query_result?.ready
+                @$el.html @template
+                    limit_value: @container.limit
+                    skip_value: @query_result.position
+                    execution_time: 12345 # ATN
+                    query: ATN
+                    has_more_data: not @query_result.ended
+                    query_has_changed: args?.query_has_changed
+                    show_more_data: not @query_result.ended and not @container.state.cursor_timed_out
+                    cursor_timed_out_template: (
+                        @cursor_timed_out_template() if not @query_result.ended and @container.state.cursor_timed_out)
+                    execution_time_pretty: 12345 # @ATN_metadata.execution_time_pretty
+                    no_results: @query_result.ended and (
+                        @query_result.value is [] or @query_result.results is []) # ATN: move to QueryResult class
+                    num_results: 12345 # ATN
+                @$('.execution_time').tooltip
+                    for_dataexplorer: true
+                    trigger: 'hover'
+                    placement: 'bottom'
+                @$('.tab-content').html @view_object.$el
+            return @
+
+        new_view: () =>
+            @view_object?.remove() 
+            @view_object = new @views[@view]
+                parent: @
+                query_result: @query_result
+            @$('.tab-content').html @view_object.$el
+            @init_after_dom_rendered()
+            @set_scrollbar()
+            # ATN @delegateEvents() ?
+
         # ATN: conitnue ripping this into pieces
         render_result: (args) =>
 
             # ATN TODO
             @ATN_metadata.execution_time_pretty = Utils.prettify_duration args.ATN_metadata.execution_time
 
-            @$el.html @template
-                limit_value: ATN_from_old_metadata
-                skip_value: ATN
-                execution_time: ATN
-                query: ATN
-                has_more_data: ATN
-                query_has_changed: args?.query_has_changed
-                show_more_data: @ATN_metadata.has_more_data is true and @container.state.cursor_timed_out is false
-                cursor_timed_out_template: (@cursor_timed_out_template() if @ATN_metadata.has_more_data is true and @container.state.cursor_timed_out is true)
-                execution_time_pretty: @ATN_metadata.execution_time_pretty
-                no_results: @ATN_metadata.has_more_data isnt true and @results?.length is 0 and @ATN_metadata.skip_value is 0
-                num_results: num_results
-
-            @view_object?.remove()
-            @view_object = new @views[@view] parent: @
-            @$('.tab-content').html @view_object.render().$el
-            @init_after_dom_rendered()
-
-            @set_scrollbar()
-            @delegateEvents()
-
-            @$('.execution_time').tooltip
-                for_dataexplorer: true
-                trigger: 'hover'
-                placement: 'bottom'
-            return @
 
         init_after_dom_rendered: =>
             @view_object?.init_after_dom_rendered?()

            @container.state.cursor_timed_out = true
            if @container.state.query_result?.ended is true
                @$('.more_results_paragraph').html @cursor_timed_out_template()

        render: =>
            @delegateEvents()
            return @

        remove: =>
            $(window).unbind 'scroll'

            @container.state.view = view
            @$(".link_to_#{@view}_view").addClass 'active'
            @$(".link_to_#{@view}_view").parent().addClass 'active'
            @new_view()

        set_scrollbar: =>
            if @view is 'table'
