Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing ng-grid with angularFire - key naming issues
    primarykey
    data
    text
    <p>I've played around with this a bit now, but can't get my head around it:</p> <p>(Using angular 1.2.2, angularFire 0.5.0 and latest ng-grid)</p> <p>So I have a firebase and I'm using angularFire to extract my data into an ng-grid component like this:</p> <pre><code>//First I go get my data, in this case something called 'grades' from ..../db/grades var promise = angularFire(new Firebase($scope.fireBaseUrl), $scope, 'grades'); //When they're fetched I start up a watcher promise.then(function(grades) { startWatchGrade($scope, filterFilter, appSettings); }); //Then I bind that grades as a datasource to my ng-grid $scope.gridOptions = { data: 'grades', enableCellSelection: false, enableRowSelection: true, etc...., </code></pre> <p>Works great and I've done controls that add new items to 'grades' (push) and remove items (splice) and everything gets reflected to the ng-grid quite nicely. Like so:</p> <pre><code>//Adding new like this is ok $scope.grades.push({some-new-data-here}); //Deleting old like this is ok $scope.grades.splice(row.rowIndex, 1); </code></pre> <p>But this approach does auto-generated int-based keys to the firebase that change all the time when modified so I wanted to get control of the keys so I changed adding the items to use instead:</p> <pre><code>var fbRef = new Firebase($scope.fireBaseUrl); var newRef = fbRef.push({some-items-here}); </code></pre> <p>And everything works ok storing the data into firebase with my non-integer ids, but it doesn't bind to the ng-grid anymore. Dumping the 'grades' into the console shows all the rows being returned, but it doesn't show up in the ng-grid.</p> <p>So in a nutshell: Integer based index generated by angularFire works ok in ng-grid, custom alphanumeric created by firebase.push doesn't.</p> <p>I hope it doesn't sound too cryptic. Thought of doing a fiddle, but let's hope it's some 'gotcha' I've overlooked and simple to solve. If not I'll try to patch one up.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload