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


Groups > comp.lang.javascript > #23416 > unrolled thread

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

Started byCornelius Lange <coni@javas.invalid>
First post2014-03-05 13:40 +0100
Last post2014-03-05 19:08 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

#23416 — undefined property, is not defined, is undefined - calling a value

FromCornelius Lange <coni@javas.invalid>
Date2014-03-05 13:40 +0100
Subjectundefined property, is not defined, is undefined - calling a value
Message-ID<lf7602$4r8$1@dont-email.me>
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:{
  options:{ ................. },
  _latlng:{lat:53.75272969271282, lng:-0.3258240222930908},
  _initHooksCalled:true,
  _leaflet_events:{ ................. },
  _popupHandlersAdded:true,
  _popup:{ ................. },  // end popup


  feature:{type:"Feature", geometry:{type:"Point", 
coordinates:[-0.32598227262497, 53.752937446804]}, 
properties:{plaqueid:"10516", plaquedesc:"<a 
href='./'>popupText</a><br><span class='id-poi'>10516</span>", 
colour:"white", imageid:""}},


  defaultOptions:{}, _leaflet_id:106,
  _map:{},
  _icon:({}),
  dragging:{ ................. }, // end dragging
  _shadow:null, _zIndex:50, edited:false
}	// end 106
}, // end _layers
  _initHooksCalled:true}
  ) // end console ... @ ...example3.js:191
----------------------------------
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] @ ...
# console.log(layers[106].feature); //
  - reference to undefined property this._animRequest @ ...leaflet.js:8
  - reference to undefined property layers[106] @ ... example3.js:191
  - layers[106] is undefined @ ... example3.js:191

# alert(Object.keys(e)); // layers,type,target
# alert(Object.getOwnPropertyNames(layers)); // _layers,_initHooksCalled
# alert(Object.keys(properties)); // properties is not defined


Where might be here the crux for me, to get this value?
What I've to see?




thanx for response,
coni

[toc] | [next] | [standalone]


#23417

FromChristian Winter <thepoet_nospam@arcor.de>
Date2014-03-05 14:23 +0100
Message-ID<53172567$0$6656$9b4e6d93@newsspool2.arcor-online.net>
In reply to#23416
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.
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,
this is the way to go).

-Chris

[toc] | [prev] | [next] | [standalone]


#23422

FromCornelius Lange <coni@javas.invalid>
Date2014-03-05 19:08 +0100
Message-ID<lf7p6o$2mk$1@dont-email.me>
In reply to#23417
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web