Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
unfortunately, the 'if' cycle does not work as I want, or, the condition is never fulfilled. I will see other functions or properties. many thanks to you my friend, thanks for all help you give me --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: Miguel, Let me put this function with comments so that you can better understand. function envia_motivos_fuc(){ var Request:Object = new Object(); //this will loop over the entire datagrid rows. Suppose you have 2 rows with checkbox selected. for(var i=0; i dg.length; i++) { // this will make sure that only the rows with checkbox selected are processes. If only two rows are checked then it'll just process those two rows. Whenever you check a checkbox, the //value of that column be TRUE or FALSE if you don't have it checked. You don't have to do [if( dg.getItemAt(i).select == true )] if(dg.getItemAt(i).select) { // this line will just get the value of the code column from your datagrid and nothing else. Since you're already putting the condition above to check if the select column in that //row was checked Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); } } } Hope that helps -- Agha -Original Message- From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 5:24 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou supposing a datagrid with 5 rows that´s function you give me: function envia_motivos_fuc(){ var Request:Object = new Object(); for(var i=0;idg.length;i++) { if(dg.getItemAt(i).select) { Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); } } } with this function I insert 0 rows in my database. after doing a debug in flex, I could see that in this function the condition of for cicle [if(dg.getItemAt(i+1).select)] is never fulfilled. after this, i realize some changes [if(dg.getItemAt(i).select = true)] in this sentence but now function insert 5 rows in my database I hope you could understand me and help me, sorry for my very poor english. thanks in advance --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: Miguel, I'm not sure what are you asking. Can you please explain the problem? Thanks Agha -Original Message- From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 11:32 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou my friend, i have this problem now if I do if(dg.getItemAt(i).select) never can enter to do: Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); i don´t know which option or function can I use ... thanks a lot anyway for all your help if you can help me now, i will be very grateful to you --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: 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;idg.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;idg.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.
Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
supposing a datagrid with 5 rows that´s function you give me: function envia_motivos_fuc(){ var Request:Object = new Object(); for(var i=0;idg.length;i++) { if(dg.getItemAt(i).select) { Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); } } } with this function I insert 0 rows in my database. after doing a debug in flex, I could see that in this function the condition of for cicle [if(dg.getItemAt(i+1).select)] is never fulfilled. after this, i realize some changes [if(dg.getItemAt(i).select = true)] in this sentence but now function insert 5 rows in my database I hope you could understand me and help me, sorry for my very poor english. thanks in advance --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: Miguel, I'm not sure what are you asking. Can you please explain the problem? Thanks Agha -Original Message- From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 11:32 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou my friend, i have this problem now if I do if(dg.getItemAt(i).select) never can enter to do: Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); i don´t know which option or function can I use ... thanks a lot anyway for all your help if you can help me now, i will be very grateful to you --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: 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;idg.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;idg.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: flexcoders@yahoogroups.com 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___| #9632; 101 name 1 #9632; 102 name 2 #9632; 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;idg.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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: I'm sorry. I should've been more clear. myData is the name of
Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
my friend, i have this problem now if I do if(dg.getItemAt(i).select) never can enter to do: Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); i don´t know which option or function can I use ... thanks a lot anyway for all your help if you can help me now, i will be very grateful to you --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: 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;idg.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;idg.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: flexcoders@yahoogroups.com 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___| #9632; 101 name 1 #9632; 102 name 2 #9632; 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;idg.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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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
RE: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
Miguel, I'm not sure what are you asking. Can you please explain the problem? Thanks Agha -Original Message- From: Miguel D�az Valenzuela [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 11:32 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou my friend, i have this problem now if I do if(dg.getItemAt(i).select) never can enter to do: Request.para = dg.getItemAt(i).code servicio_datos_motivos.send(Request); i don´t know which option or function can I use ... thanks a lot anyway for all your help if you can help me now, i will be very grateful to you --- In flexcoders@yahoogroups.com, Mehdi, Agha [EMAIL PROTECTED] wrote: 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;idg.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;idg.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: flexcoders@yahoogroups.com 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___| #9632; 101 name 1 #9632; 102 name 2 #9632; 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;idg.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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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)
Re: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
Hi I am working in Flex. I have one application in that there are 4 tabs. one tab is , details,second one is contacts, third one is devices like that... in second tab i have combobox cell renderer in datagrid for phone type. i have to bind data in that through database. and save the details and in another tab checkbox in datagrid is there. if i check the box and call the save method . i have to save that how to do that Please explain with example Its urgent Thank you satish On Tue, 1 Feb 2005 09:17:11 -0800, 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: flexcoders@yahoogroups.com 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 abouta 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 flexcoders@yahoogroups.com, 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
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___| #9632; 101 name 1 #9632; 102 name 2 #9632; 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;idg.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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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
RE: [flexcoders] Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
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;idg.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;idg.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: flexcoders@yahoogroups.com 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___| #9632; 101 name 1 #9632; 102 name 2 #9632; 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;idg.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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com Subject: [flexcoders] Re: how can I do this in Flex? -- (warning, best-practice police are in the hou Well, many thanks to you
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 flexcoders@yahoogroups.com, 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.
Re: how can I do this in Flex? -- (warning, best -practice police are in the hou
yeah man, i think that is for me, i will check you suggestion many thanks to you Agha --- In flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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
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 flexcoders@yahoogroups.com, 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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 flexcoders@yahoogroups.com, 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