Search the web
Sign In
New User? Sign Up
ydn-javascript · Yahoo! User Interface Library Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Changing datatable row content   Message List  
Reply | Forward Message #50240 of 52114 |
Re: [ydn-javascript] Changing datatable row content

Thank you for your help Dan; I really appreciate it.

2009/7/4 Satyam <satyam@...>


Douglas Crockford always says 'eval is evil'. JSLint will scream at you
so I would assume you didn't pass it by JSLint or didn't fix all its
diagnostics. Please do, it really spares you lots of trouble. Avoid
such constructs, there is hardly any that cannot be expressed some other
way, like:



eval("rec." + oReg[0].childNodes[i].nodeName + "='" +
oReg[0].childNodes[i].textContent + "'");

rec[oReg[0].childNodes[i].nodeName] = oReg[0].childNodes[i].textContent;

I can't say right away what's wrong with your code. I can only suggest
you use more intermediate variables to hold references that you will use
time and time again, like:

myDataTable.getSelectedRows()[0]

or

oReg[0].childNodes

And then, there is nothing more than single-stepping through that
segment of code checking those intermediate values to see if they make
sense, which they look Ok, but there is obviously something missing.

Satyam

Daniel escribió:

>
>
> Hello,
>
> it's strange sometimes it the row gets updated with "undefined", i
> think it has to be with XML load time. What can I do in order to fix it?
>
> The example ishttp://investigacion.ilce.edu.mx/inventario/inventarios.html
>
> 2009/7/3 Daniel <ikaro75@... <mailto:ikaro75@...>>

>
> I solved it with this code:
>
> oReg=o.responseXML.getElementsByTagName("registro");
> var rec =
> myDataTable.getRecordSet().getRecord(myDataTable.getSelectedRows()[0]).getData();
>
>
> for (i=0;i<oReg[0].childNodes.length;i++) {
> eval("rec." + oReg[0].childNodes[i].nodeName + "='" +
> oReg[0].childNodes[i].textContent + "'");
> }
> myDataTable.updateRow(myDataTable.getSelectedRows()[0],rec );
>
> 2009/7/3 ikaro751 <ikaro75@... <mailto:ikaro75@...>>

>
>
>
> Hello, I'm tring to update the row selected in a datatable;
> I have the new values in a XML node; the number of nodes in
> the responseXML is the same as the recordset in the datatable;
> how do I update the row?
>
> This is how I'm trying to do it, but I get a invalid assigment
> left-hand side.
>
> oReg=o.responseXML.getElementsByTagName("registro");
> for (i=0;i<oReg[0].childNodes.length;i++) {
> myDataTable.getRecordSet().getRecord(myDataTable.getSelectedRows()[0]).setData(i)=oReg[0].childNodes[i].textContent;
> }
>
> Thanks for your help!
>
>
>
>
>
>
> ----------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.3/2216 - Release Date: 07/03/09 05:53:00
>
>




Sat Jul 4, 2009 5:22 pm

ikaro751
Offline Offline
Send Email Send Email

Forward
Message #50240 of 52114 |
Expand Messages Author Sort by Date

Hello, I'm tring to update the row selected in a datatable; I have the new values in a XML node; the number of nodes in the responseXML is the same as the...
ikaro751
Offline Send Email
Jul 3, 2009
3:32 pm

I solved it with this code: oReg=o.responseXML.getElementsByTagName("registro"); var rec = ...
Daniel
ikaro751
Offline Send Email
Jul 3, 2009
5:23 pm

Hello, it's strange sometimes it the row gets updated with "undefined", i think it has to be with XML load time. What can I do in order to fix it? The example...
Daniel
ikaro751
Offline Send Email
Jul 3, 2009
6:06 pm

Douglas Crockford always says 'eval is evil'. JSLint will scream at you so I would assume you didn't pass it by JSLint or didn't fix all its diagnostics....
Satyam
satyamutsa
Offline Send Email
Jul 4, 2009
3:16 pm

Thank you for your help Dan; I really appreciate it. 2009/7/4 Satyam <satyam@...> ... Thank you for your help Dan; I really appreciate it. 2009/7/4...
Daniel
ikaro751
Offline Send Email
Jul 4, 2009
5:22 pm

it is not setData(i) = something but setData(i,something) setData returns nothing (void) and you can't assign anything to nothing. Anyway, DataTable's...
Satyam
satyamutsa
Offline Send Email
Jul 4, 2009
7:32 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help