Hey Eric,

So far in my branch I have Firebase.key(), limitToFirst(), limitToLast(), 
child_moved working. I have orderByChild, orderByKey, and orderByKey 
partially working.

When I use my firebase-element:

    <firebase-element id="dinosaurOrderByChild" on-data-change=
"{{dinosaurOrderByChildDataChange}}" data="{{dinosaurOrderByChildData}}" 
keys="{{dinosaurOrderByChildKeys}}" orderByChild="order" location=
"https://dinosaur-facts.firebaseio.com/"; log></firebase-element>


The console shows that the child-addd have been sorted ok, but the data 
stored in dinosaurOrderByChildData is not sorted.

Console log messages:
child-added lambeosaurus firebase-element.html:420
child-added stegosaurus firebase-element.html:420
child-added triceratops firebase-element.html:420
child-added pterodactyl firebase-element.html:420
child-added bruhathkayosaurus firebase-element.html:420
child-added linhenykus firebase-element.html:420
acquired value https://dinosaur-facts.firebaseio.com/ 
firebase-element.html:321

And the object stored in dinosaurOrderByChildData is not sorted.
{bruhathkayosaurus: Object, lambeosaurus: Object, linhenykus: Object, 
pterodactyl: Object, stegosaurus: Object…}

*Do you have and idea why this is happening?*

See full code at:
https://github.com/chuckh/firebase-element/blob/firebase-2.0.0/firebase-element.html
 
https://github.com/chuckh/firebase-element/blob/firebase-2.0.0/demos/firebase.html
 
(demo)

Requery function
```
requery: function() {
      // shut-down previous observers (if any)
      this.closeQuery();
      this.closeObserver();
      // construct new query
      var query = this.ref;
      if (query) {
        if (this.start && !this.orderByKey) {
          console.log("requery: startAt", this.start);
          query = query.startAt(this.start);
        }
        if (this.end) {
          query = query.endAt(this.end);
        }
        if (this.limit > 0) {
          query = query.limit(this.limit);
        }
        if (this.limitToFirst > 0) {
          query = query.limitToFirst(this.limitToFirst);
        }
        if (this.limitToLast > 0) {
          query = query.limitToLast(this.limitToLast);
        }
        


*if (this.orderByChild) {          console.log("requery: orderByChild", 
this.orderByChild, this.ref);          query = 
query.orderByChild(this.orderByChild);        }*
        if (this.orderByKey) {
          if (this.start) {
            query = query.orderByKey().startAt(this.start);
          } else  {
            query = query.orderByKey();
          }
          // console.log("requery: orderByKey", query);
        }
        if (this.orderByPriority) {
          console.log("requery: orderByPriority", this.ref);
          query = query.orderByPriority();
        }
        this.query = query;
        // console.log("requery: query", this.query)
      }
    },


```

On Wednesday, November 5, 2014 9:56:01 AM UTC-8, Eric Bidelman wrote:
>
> Hey Chuck, the fb element is very basic and doesn't support a lot of 
> firebase's awesome. PRs or new elements to that repo are welcome :)
> On Nov 5, 2014 5:03 AM, "Chuck Horton" <[email protected] <javascript:>> 
> wrote:
>
>> Does the firebase-element support the new Firebase Richer Query 
>> Capabilities or does it need to be updated? See 
>> https://www.firebase.com/blog/2014-11-04-firebase-realtime-queries.html 
>> for announcement.
>>
>> Example from (
>> https://www.firebase.com/blog/2014-11-04-firebase-realtime-queries.html)
>> var ref = new Firebase("https://dinosaur-facts.firebaseio.com/";);
>> ref.orderByChild("height").on("child_added", function(snapshot) {
>>   console.log(snapshot.key() + " was " + snapshot.val().height + " 
>> meters tall");
>> });
>>
>> Another example from (
>> https://www.firebase.com/blog/2014-11-04-firebase-realtime-queries.html)
>> var ref = new Firebase("https://dinosaur-facts.firebaseio.com/";);
>> ref.orderByChild("height").startAt(3).on("child_added", function(snapshot
>> ) {
>>   console.log(snapshot.key())
>> });
>>
>>  Follow Polymer on Google+: plus.google.com/107187849809354688692
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Polymer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/polymer-dev/7a560412-09a6-4957-930c-5a95ae9cf2b8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/polymer-dev/7a560412-09a6-4957-930c-5a95ae9cf2b8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/39c2d58f-e3da-49f8-aa3e-f4681e643d01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to