×
Getting new Releases

To get notified on new releases you may follow us on twitter @expandframework or subscribe in our main RSS feed.

Topic-icon XpandNavigationItemAttribute add property for "node id "

More
1 month 3 weeks ago #11533 by K1
K1 created the topic: XpandNavigationItemAttribute add property for "node id "
Currently the generated IModelNavigationItem id and caption are same

I suggest that 'id' can be customized and can be provided in XpandNavigationItemAttribute constructor.

Example
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
    public class XpandNavigationItemAttribute : Attribute, ISupportViewId {
		readonly int _index = -1;
        readonly string _path;
        readonly string _viewId;

        public XpandNavigationItemAttribute(string path, string viewId=null, int index = -1) 
		: this(path, viewId, null, index) {}

        public XpandNavigationItemAttribute(string path, string viewId, string objectKey, int index = -1) {
            _path = path;
            _viewId = viewId;
            _index = index;
            ObjectKey = objectKey;
			
			var paths = _path.Split('/');
			Id = paths[0];
        }
        
		public XpandNavigationItemAttribute(string path, string viewId, string objectKey,  string id, int index = -1) {
            _path = path;
            _viewId = viewId;
            _index = index;
            ObjectKey = objectKey;
			Id =  id;
        }
		
		public string Id { get; set; }
		
        public int Index {
            get { return _index; }
        }

        public string Path {
            get { return _path; }
        }

        public string ObjectKey { get; set; }

        public string ViewId {
            get { return _viewId; }
        }
    }


Then XpandNavigationItemNodeUpdater we simply use the Id

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #11536 by Tolis
Tolis replied the topic: XpandNavigationItemAttribute add property for "node id "
thnks for the suggestion I will come back as soon as I review it

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #11539 by Tolis
Tolis replied the topic: XpandNavigationItemAttribute add property for "node id "
what's the reasoning behind

Id = paths[0];

don't you think

id = paths.Last()

is a better candidate?

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago - 2 weeks 5 days ago #11628 by K1
K1 replied the topic: XpandNavigationItemAttribute add property for "node id "

Tolis wrote: what's the reasoning behind

Id = paths[0];

don't you think

id = paths.Last()

is a better candidate?


Thanks for you correction, Actually I will tell you a secret : I didn't test the code I just wrote it in text editor to illustrate the idea :blush:
Last Edit: 2 weeks 5 days ago by K1.

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago #11630 by Tolis
Tolis replied the topic: XpandNavigationItemAttribute add property for "node id "
no worries feel free to post your ideas

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand

Please Log in or Create an account to join the conversation.

Time to create page: 0.359 seconds