 
         show_tree: (event) =>
             event.preventDefault()
-            @prototype.view = 'tree'
-            @render_result()
+            @set_view 'tree'
         show_table: (event) =>
             event.preventDefault()
-            @prototype.view = 'table'
-            @render_result()
+            @set_view 'table'
         show_raw: (event) =>
             event.preventDefault()
-            @prototype.view = 'raw'
+            @set_view = 'raw'
+
+        set_view: (view) =>
+            @view = view
+            @container.saved_data.view = view
+            @container.save_data_in_localstorage()
             @render_result()
 
         render_error: (query, err) =>

                        cursor: null
                        metadata: null
                        cursor_timed_out: true
            # Else the user created a data explorer view before

            # Load history, keep it in memory for the session

                no_results: @metadata.has_more_data isnt true and @results.length is 0 and @metadata.skip_value is 0
                num_results: ((@metadata.skip_value+@results.length) if @metadata.has_more_data isnt true)

            switch @view
                when 'tree'
                    @.$('.json_tree_container').html @json_to_tree @results
                    @$('.results').hide()
