App.QueryController = Ember.Controller.extend({
  needs: ['insight'],

  columnsBinding: "controllers.insight.columns",
  limitBinding: "controllers.insight.limit",

  _schema: Em.ArrayProxy.create({content:[]}),
  _records: Em.ArrayProxy.create({content:[]}),

  schema: function(){
    this.execute();
    return this._schema;
  }.property(),

  records: function(){
    this.execute();
    return this._records;
  }.property(),


  url: function(){
    var cols = this.get('columns');
    return "/json?limit=%@".fmt(this.get('limit')) +
      (cols ? "&cols=%@".fmt(cols):"");
    
  }.property("columns"),


  execute: _.debounce(function(){
    var self = this;
    var array = [];
    Ember.$.getJSON(this.get('url'), function(json) {
      var schema = json.schema;

      self.set('_schema.content', schema);
      
      json.records.forEach(function(record,i){
        var o = _.object(schema, record);
        array.push(Em.Object.create(o));          
      });

      self.set('_records.content', array);
    });
    return self;
  },300).observes('url')

});

@@ -63,16 +63,47 @@
 ight'%5D,%0A
+  orderBy: null,%0A  where: null,
 %0A  colum
@@ -188,16 +188,61 @@
 .limit%22,
+%0A  whereBinding: %22controllers.insight.where%22,
 %0A%0A  _sch
@@ -521,24 +521,25 @@
 tion()%7B%0A
+%0A
     var 
 cols = t
@@ -534,14 +534,81 @@
 var 
-cols
+args = %5B%0A      %22limit=%25@%22.fmt(this.get('limit')),%0A%0A    %5D%0A    var limit
  =
+ 
  thi
@@ -618,138 +618,445 @@
 et('
-columns');%0A    return %22/json?limit=%25@%22
+limit');%0A%0A    var orderBy = this.get('orderBy');%0A    if(orderBy)%7B%0A      args.push('order_by=%25@'
 .fmt(
-this.get('limit')) +
+orderBy.join(' ')));%0A    %7D%0A%0A    var cols = this.get('columns');
 %0A    
-  
+if
 (cols
- ? %22&cols=%25@%22.fmt(cols):%22%22);%0A    %0A  %7D.property(%22columns
+)%7B%0A      args.push(%22cols=%25@%22.fmt(cols));%0A    %7D%0A%0A    var where = this.get('where');%0A    console.log(where)%0A    if(where)%7B%0A      args.push(%22where=%25@%22.fmt(where));%0A    %7D%0A%0A%0A    return %22/json?%22 + args.join('&');%0A    %0A  %7D.property(%22columns%22, %22limit%22, %22orderBy%22, %22where
 %22),%0A

Allow editing of filters, ordering and limits.