Undefined selected model
Hi all, im try to get the selected model via onClick button event. I have the multiselect option set as true, and when select an item an click the button, the selected model is undefined.
// psuedo var this is the view, not works with this.view (as the doc says). var models = this.getSelectedModels(); console.log(models);
My model and collection are defined as follows:
var Model = Backbone.Model.extend();
var ModelsCollection = Backbone.Collection.extend({ model: Model, url: Routing.generate('usuarios_retrieve') });
Any ideas ?
Can you write full code for bbGrid.View ?
My full code is:
var Model = Backbone.Model.extend();
var ModelsCollection = Backbone.Collection.extend({
model: Model,
url: Routing.generate('usuarios_retrieve')
});
var myCollection = new ModelsCollection();
var edit_user = function(){
var models = this.getSelectedModels();
console.log(models);
};
var myButtons = [
{title: '<i class="icon-edit"></i>', onClick: edit_user}
];
var grid = new bbGrid.View({
container: $("#datagrid"),
collection: myCollection,
colModel: [
{title: 'ID', name: 'iduser'},
{title: 'Apellido', name: 'apellido', sorttype: 'string', filter: true, filterType: 'input'},
{title: 'Nombre', name: 'nombre', filter: true, filterType: 'input'},
{title: 'DNI', name: 'dni'},
{title: 'Fecha nacimiento', name: 'fecha_de_nacimiento'},
{title: 'Domicilio', name: 'domicilio'},
{title: 'Email', name: 'email'}
],
autofetch: true,
rows: 10,
rowList: [5, 10, 15, 20, 25],
buttons: myButtons,
multiselect: true
});
Note: The grid view is render ok.
It's working. http://jsfiddle.net/P7utr/ your code below. What version of underscore? (try to update to latest).
Oh, im using the latest stable (1.5.2).
I am also facing same issue. Any update on this bug?