PDA

View Full Version : [CLOSED] Get the Field of a Store



osef
Oct 17, 2013, 1:38 AM
Hi, How Can I get the Field "Precio" in the next code:



<Store>
<ext:Store ID="sAgregarCita" runat="server">
<Listeners>
<Add Fn="sumarTotal" />
</Listeners>
<Model>
<ext:Model ID="mAgregarCita" runat="server">
<Fields>
<ext:ModelField Name="Articulo" Type="String" />
<ext:ModelField Name="Descripcion1" Type="String" />
<ext:ModelField Name="TiempoEntregaSeg" Type="Int" />
<ext:ModelField Name="TiempoEntrega" Type="Int" />
<ext:ModelField Name="Precio" Type="Float" />
<ext:ModelField Name="PDescuento" Type="Int" />
<ext:ModelField Name="Descuento" Type="Boolean" />
<ext:ModelField Name="Importe" Type="Date"/>
<ext:ModelField Name="Fecha" Type="Date" />
<ext:ModelField Name="Hora" Type="Boolean" />
<ext:ModelField Name="Sala" Type="String" />
<ext:ModelField Name="Medico" Type="String" />
<ext:ModelField Name="Tecnico" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>




var sumarTotal = function (store, data) {
//Here I want to get the value to "Precio"
console.log(data....);
};


I know that,Listener Add it has the parameter Store, Data and Column, but I don't know How Can I to get the value by the field "Precio" in the parameter data?

Baidaly
Oct 17, 2013, 2:06 AM
Hello!

Your second arguments is an array of records so if should like in the sample below:

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store-event-add
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model-method-get


var sumarTotal = function (store, data) {
//Here I want to get the value to "Precio"
console.log(data[0].get('Precio'));
};

osef
Oct 17, 2013, 3:38 AM
Hello!

Your second arguments is an array of records so if should like in the sample below:

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store-event-add
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model-method-get


var sumarTotal = function (store, data) {
//Here I want to get the value to "Precio"
console.log(data[0].get('Precio'));
};

Thank you Baidaly