Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23422

Re: undefined property, is not defined, is undefined - calling a value

From Cornelius Lange <coni@javas.invalid>
Newsgroups comp.lang.javascript
Subject Re: undefined property, is not defined, is undefined - calling a value
Date 2014-03-05 19:08 +0100
Organization A noiseless patient Spider
Message-ID <lf7p6o$2mk$1@dont-email.me> (permalink)
References <lf7602$4r8$1@dont-email.me> <53172567$0$6656$9b4e6d93@newsspool2.arcor-online.net>

Show all headers | View raw


Am 05.03.2014 14:23, schrieb Christian Winter:
> Am 05.03.2014 13:40, schrieb Cornelius Lange:
>> hey,
>>
>> does someone give a helping hand to find my blind spot -
>> in trying to call the value from "plaqueid"? (10516):
>>
>> the (shortend) datastructure is:
>> ----------------------------------
>> (
>> {
>> _layers:{
>> 106:{
> [...snip...]
>> this datastructure was given by console.log(layers);
>> - from following "calling-place":
>>
>> the calling code from example3.js
>> ----------------------------------
>> function init() { ...
>>   map.on('draw:edited', function (e) {
>>      var layers = e.layers;
>>           alert(options.feature.plaqueid);    // here calling
>>      layers.eachLayer(function(layer) {    });    });
>> ... }
>> ----------------------------------
>> (shortend too)
>>
>> I don't get further into the datastructur than "layers[106]" - by trying
>> e.g. with
>>
>> # console.log(layers); // ok, shown all.
>> # console.log(layers[106]); // ...undefined property layers[106] @ ...
> [....snip...]
>> Where might be here the crux for me, to get this value?
>> What I've to see?
>
> If you're really dumping "layers" and get the structure above
> (shortened):
>     { _layers: { 106: {...} } }
> then you're not looking deep enough.
may be - yes: I'm still "spelling" Javascript ...



> layers._layers[106] would be the way to go. Might be that your
> layers object has accessors for the individual layers, guessing from
> the usually "pseudo-private" underscore notation, and should be written
> as something like layers.getLayer(106) (or whatever accessor syntax
> it has, though if I'm guessing right and you're working with Leaflet,
yes. Just "mess around" with the "draw:edited"-feature, for trying to 
save stuff into the table.



> this is the way to go).
Thanx a lot!!
both is working and gives the id:
layers._layers[106].feature.properties.plaqueid
layers.getLayer(106).feature.properties.plaqueid



>
> -Chris


Coni

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

undefined property, is not defined, is undefined - calling a value Cornelius Lange <coni@javas.invalid> - 2014-03-05 13:40 +0100
  Re: undefined property, is not defined, is undefined - calling a value Christian Winter <thepoet_nospam@arcor.de> - 2014-03-05 14:23 +0100
    Re: undefined property, is not defined, is undefined - calling a value Cornelius Lange <coni@javas.invalid> - 2014-03-05 19:08 +0100

csiph-web