Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relateion table does not work for dynamic layers #30

Closed
mtabdar opened this issue Mar 31, 2017 · 11 comments
Closed

Relateion table does not work for dynamic layers #30

mtabdar opened this issue Mar 31, 2017 · 11 comments

Comments

@mtabdar
Copy link

mtabdar commented Mar 31, 2017

Hi
Thanks for the amazing widgets espcially the relation table. It is fantastic but i couldn't use it with my dynamic layers. is it a bug or i am doing something wrong?

@green3g
Copy link
Owner

green3g commented Mar 31, 2017

Nope, its not a bug, its just a limitation of the widget. It uses Feature layer "clicks" to do the query. I do have an example of it working with dynamic layers though, but it works a little differently. It uses the identify popup to display the table instead. Would that meet your needs?

https://github.com/roemhildtg/cmv-widgets/tree/master/widgets/RelationshipTable#include-in-identify-popup

@mtabdar
Copy link
Author

mtabdar commented Mar 31, 2017

Thanks. In fact it is exactly what i want but i cannot do it!
I used your samples just changed the urls to my own. Then i set identify to show relation tables it workd fine for "petrolium" (why is it not petroleum?) which is feature layer but couldndo the same for timekansas which is dynamic. I also changed petroleum to dynamic and the identify stopped showing relation table.!!?

@green3g
Copy link
Owner

green3g commented Mar 31, 2017

Does the identify show up at all? Or are there error messages?

@mtabdar
Copy link
Author

mtabdar commented Mar 31, 2017

Yes identify shows regular identify values and no errors just some svg.js errors which are not related to this.

@green3g
Copy link
Owner

green3g commented Mar 31, 2017

Off the top of my head, it sounds llike your layer id might not match up with your identify layer id.

In viewer.js (or main cmv config file), what is:

  • layer.type
  • layer.options.id
  • layer.url (not the fulll url, but whether its /MapServer/0 or /Maperver or /Mapserver/1 etc

In identify.js config file, what is:

  • the name of your identifies layer
  • the number of your identifies sublayer

For example, I have a dynamic layer:

        {
            id: 'assets',
            type: 'dynamic',
            url: '/arcgis/rest/services/internal/assets/MapServer',
            title: 'Assets and Utilities',
            options: {
                id: 'assets'
            },
            layerControlLayerInfos: {
                expanded: true
            }
        }

and my identifies info looks like this:

identifies: {
    assets: {
            25: {
            title: 'Street Segmenet {cid}',
            content: factory([{
                title: 'History',
                objectIdField: 'OBJECTID',
                relationshipId: 4,
                url: '/arcgis/rest/services/internal/assets/MapServer/25',
                columns: [{
                    field: 'Operation'
                }, {
                    field: 'op_year',
                    label: 'Year'
                }]
            }])
        },
    }
}

@green3g
Copy link
Owner

green3g commented Mar 31, 2017

Similarly, for feature layers, the only thing you'd need to change is this in viewer.js:

{
            id: 'assets',
            type: 'feature',
            url: '/arcgis/rest/services/internal/assets/MapServer/25',
            title: 'Assets and Utilities',
            options: {
                outFields: '*',
                id: 'assets'
            },
            layerControlLayerInfos: {
                expanded: true
            }
        },

@mtabdar
Copy link
Author

mtabdar commented Apr 1, 2017

Yes you are right. When i checked and corrected sublayer id's and relation id's i could see the related records in identify for dynamic layer. Thanks.
Though i have 2 problems

  1. My layer with id =0 doesn't show the related records
  2. Although i have set a 1:M relationship and provided several records in the table for each objectid, only one record is shown as the result.

@green3g
Copy link
Owner

green3g commented Apr 2, 2017

There's a fix for number 1, it is a bug in the identify widget: cmv/cmv-app#706

For number 2, it might be helpful for you to look at the network logs when you do the identify. Then you can see what query is being passed to the server, and what it is returning as a response.

@mtabdar
Copy link
Author

mtabdar commented Apr 3, 2017

thanks.
1- i think you are right about "layer with id =0" because i encountered some other issues with it (label layers for example) but unfortunately i couldn't understand if there is a fix available or the root of the problem is identified and you are trying to fix it?
2- again you are right and i should investigate more about it.
thanks a lot for the help.

@green3g
Copy link
Owner

green3g commented Apr 3, 2017

The problem is identified, but has not been included in cmv-app yet.
The only change that needs to happen is in gis/dijit/Identify.js https://github.com/cmv/cmv-app/blob/64b0a2fbdc07fcb7652cc8d75aac205729a341a2/viewer/js/gis/dijit/Identify.js#L400

@green3g
Copy link
Owner

green3g commented Apr 21, 2017

This fix is now in the cmv develop branch. You should be able to download the latest version and have this issue resolved.

@green3g green3g closed this as completed Apr 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants