Miguel,
Compare function1 with the one you sent. Notice, that I have
"dg.getItemAt(i)" instead of "dg.getItemAt(i+1)" and you can get specific
value from the column by giving the column Name like "dg.getItemAt(i).code"
When you do dg.getItemAt(i), it returns you the entire row row for that
index. The row is an object containing all the columns you have in the
dataprovider of the datagrid.
=======Function 1==================================================
function envia_motivos_fuc(){
var Request:Object = new Object();
var selectedData:Array = new Array();
for(var i=0;i<dg.length;i++) ----> dg is datagrid�s name
{
if(dg.getItemAt(i).select)
{
Request.para = dg.getItemAt(i).code ----> here i�m specified a
parameter
servicio_datos_motivos.send(Request); ----> that�s webservice
}
}
}
=========================================================
One more thing that it'll work if you select only one checkbox in the grid
but if you're doing multiple selections from the checkbox then it'll create
problems since for every single selected checkbox, you're sending single
value to the webservice. It'll make a lot more sense if you populate an
array with all the selected items and send that array to the server.
function envia_motivos_fuc()
{
var Request:Object = new Object();
var selectedData:Array = new Array();
for(var i=0;i<dg.length;i++) ----> dg is datagrid�s name
{
if(dg.getItemAt(i).select)
{
selectedData.push( dg.getItemAt(i).code );
}
}
Request.para = selectedData ----> here i�m specified a parameter
servicio_datos_motivos.send(Request); ----> that�s webservice
}
This way you send any array with all the selected codes at once, which makes
it easier to manage. Let me know if you have any question.
-- Agha
-----Original Message-----
From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 02, 2005 7:28 AM
To: [email protected]
Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best
-practice police are in the hou
mmm, i have a question now, how can i get only one column of a row i need to
send it how a parameter, but no all row, only a column
for example
|___select one___|___code___|___name___|
■ 101 name 1
■ 102 name 2
■ 103 name 3
supposing that I select the second row, I want to take code only, that is to
say, " 102", and this value I want to send it as parameter through an aspx
file across a webservice (which is already done)
my another problem is I do not know if the function to extract the value is
realized well
that�s code:
function envia_motivos_fuc(){
var Request:Object = new Object();
var selectedData:Array = new Array();
for(var i=0;i<dg.length;i++) ----> dg is datagrid�s name
{
if(dg.getItemAt(i+1).select)
{
Request.para = dg.getItemAt(i).rowIndex(i+1) ----> here i�m
specified a parameter
servicio_datos_motivos.send(Request); ----> that�s webservice
}
}
}
thanks in advance for all help
--- In [email protected], Miguel D�az Valenzuela
<[EMAIL PROTECTED]> wrote:
>
> don�t worry, thanks for help me :)
> will check it out tomorrow, now i�m going to house :P
>
> --- In [email protected], "Mehdi, Agha" <[EMAIL PROTECTED]> wrote:
> > I'm sorry. I should've been more clear. myData is the name of your
> datagrid.
> >
> >
> > -----Original Message-----
> > From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, February 01, 2005 1:40 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: how can I do this in Flex? -- (warning,
> > best -practice police are in the hou
> >
> >
> >
> > I have a problem, what kind of variable is myData?
> >
> > sorry for my ignorance
> >
> > --- In [email protected], Miguel D�az Valenzuela
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > yeah man, i think that is for me, i will check you suggestion
> > >
> > > many thanks to you Agha
> > >
> > > --- In [email protected], "Mehdi, Agha" <[EMAIL PROTECTED]>
wrote:
> > > > Miguel,
> > > >
> > > > If I'm right about your question then here's the solution.
> > > >
> > > > The datagrid has 4 columns. One of them has checkboxes in it.
> > > >
> > > > Datagrid = myData
> > > >
> > > > Column1 = select (with checkboxes)
> > > > Column2 = name
> > > > Column3 = age
> > > > Column4 = city
> > > >
> > > > Var selectedData = new Array();
> > > >
> > > > For ( var i = 0; i < myData.length; i++ ) {
> > > > if ( myData.getItemAt(i).select )
> > > > {
> > > > selectedData.push( myData.getItemAt(i) );
> > > > }
> > > > }
> > > >
> > > > selectedData array will now hold all the items from the datagrid
> > > where the
> > > > checkbox is selected. To get other columnvalues you can simply
say:
> > > >
> > > > Name = selectedData[0].name;
> > > > Age = selectedData[0].age;
> > > >
> > > > Please let me know if that's what you wanted.
> > > >
> > > > Thanks
> > > >
> > > > -- Agha
> > > >
> > > > -----Original Message-----
> > > > From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, February 01, 2005 7:37 AM
> > > > To: [email protected]
> > > > Subject: [flexcoders] Re: how can I do this in Flex? --
> > > > (warning, best-practice police are in the hou
> > > >
> > > >
> > > >
> > > > Well, many thanks to you for help me.
> > > > I know about webservice and I have already realized an "insert"
> > > > to
> > > datebase
> > > > through Flex with simple textimputs or textareas, but my
trouble is
> > > about a
> > > > checkrenderer. I must count records of a datagrid, see which of
> > > > those records they are checked, and extract the value of a
> column of
> > > > the
> > above
> > > > mentioned record. In .NET everything is very explicit, but in
Flex I
> > > do not
> > > > know that codes to use in the .as code of my .mxml file.
> > > > I know that to count rows of a datagrid i can use rowCount,
but for
> > > others
> > > > two tasks I cannot which option use (rowIndex, i don't know)
> > > >
> > > > sorry for my poor english, and i hope you understand me.
> > > > many thanks in advance
> > > >
> > > > --- In [email protected], "Steven Webster"
<[EMAIL PROTECTED]>
> > > wrote:
> > > > > Miguel,
> > > > >
> > > > > > Actually i´m learning to use Macromedia Flex and i´m
> > > > > > working
> > with
> > > > > > a checkrenderer datagrid, but in this moment i have a trouble.
> > > > > >
> > > > > > I need to do a insert info a for(...) sentence, but i can´t
> > > > > > find correct code for do that.
> > > > > >
> > > > > > This is code in .NET
> > > > >
> > > > > With .NET, it's quite common for the "page-technology" to
> > > > > embed SQL connection information. This isn't a failing of
> > > > > .NET as
such
> > > > > (as there are good practices with ADO.NET and the Microsoft
> > > > > Enterprise Patterns that can be followed) but is a common
2-tier
> > > > > solution
> > > that we
> > > > > see people implementing, especially from an ASP.NET / VB.NET
> > > > > background.
> > > > >
> > > > > Flex does not offer explicit support for SQL; it is a
> presentation
> > > > > tier solution, that assumes that any business logic will be
> > performed
> > > > > on the server-side of the wire. So - I would expect you to
> > > > > have
> > some
> > > > > .NET code (VB.NET, C#, etc) that uses the ADO.NET libraries to
> > > perform
> > > > > any SQL queries that you wish to perform, and that this code
> > > reside on
> > > > > your server. You will then expose that business tier logic to
> > > > > Flex
> > > > > (currently) through a WebService interface - if you are using
> > > > > C#
> > for
> > > > > instance, this is a very simple thing to do using metadata
tags on
> > > the
> > > > > class that encapsulates your data access.
> > > > >
> > > > > Once you have defined a service on the server, Flex can then
> > > > > use
> > the
> > > > > WebService tag to invoke that service; rather than build up
a SQL
> > > > > query on the client (which is a *very* bad, though
frustratingly
> > > > > common practice) you would instead pass the relevant data
(such as
> > > > > "tipo_mant_id") as an argument in a WebService call, such as
> > > > > agregaDetalleMantencionComputador(),
> > > > > and receive the results back from Flex.
> > > > >
> > > > > Once you have that n-tier architecture in place (Flex is a
> > > replacement
> > > > > for the presentation tier *only*) then how to invoke web
> > services on
> > > > > the server, and how to handle the results that you get back,
etc,
> > > will
> > > > > all be much clearer to you from the documentation and
> > > > > (shameless
> > > plug)
> > > > > books that are out there.
> > > > >
> > > > > So I'm afraid I'd be tempted to suggest that if you want to
> > > > > embrace Flex as a presentation-tier solution, abandon all
> hopes of
> > > > > 2-tier (database code from your integration tier intermingled
> with
> > > > > presentation tier code) architecture, and avoid a run-in
with the
> > > > > best-practice police...
> > > > >
> > > > > Hope this helps,
> > > > >
> > > > > Best,
> > > > >
> > > > > Steven
> > > > > PS. The only other word I know is 'cerveza'
> > > > >
> > > > > --
> > > > > Steven Webster
> > > > > Technical Director
> > > > > iteration::two
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > > Office: +44 (0)131 338 6108
> > > > > Mobile: +44 (0)7977 216 223
> > > > >
> > > > > This e-mail and any associated attachments transmitted with
it may
> > > > contain
> > > > > confidential information and must not be copied, or
disclosed, or
> > > > used by
> > > > > anyone other than the intended recipient(s). If you are not
> > > > > the intended
> > > > > recipient(s) please destroy this e-mail, and any copies of it,
> > > > immediately.
> > > > >
> > > > > Please also note that while software systems have been used
to try
> > > > to ensure
> > > > > that this e-mail has been swept for viruses, iteration::two
do not
> > > > accept
> > > > > responsibility for any damage or loss caused in respect of any
> > > viruses
> > > > > transmitted by the e-mail. Please ensure your own checks are
> > carried
> > > > > out before any attachments are opened.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ----
> > > > This email may contain confidential and privileged material
for the
> > > sole use of the intended recipient(s). Any review, use,
distribution
> > > or disclosure by others is strictly prohibited. If you are not the
> > > intended recipient (or authorized to receive for the recipient),
> > > please contact the sender by reply email and delete all copies of
> this
> > > message.
> > > >
> > > > To reply to our email administrator directly, send an email to
> > > > [EMAIL PROTECTED]
> > > >
> > > > Littler Mendelson, P.C.
> > > > http://www.littler.com
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> > ----
> > This email may contain confidential and privileged material for the
> sole use of the intended recipient(s). Any review, use, distribution
> or disclosure by others is strictly prohibited. If you are not the
> intended recipient (or authorized to receive for the recipient),
> please contact the sender by reply email and delete all copies of this
> message.
> >
> > To reply to our email administrator directly, send an email to
> > [EMAIL PROTECTED]
> >
> > Littler Mendelson, P.C.
> > http://www.littler.com
Yahoo! Groups Links
----
This email may contain confidential and privileged material for the sole use of
the intended recipient(s). Any review, use, distribution or disclosureby others
is strictly prohibited. If you are not the intended recipient (or authorized to
receive for the recipient), please contact the sender by reply email and delete
all copies of this message.
To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]
Littler Mendelson, P.C.
http://www.littler.com