Kentico 8 - Custom Page Type Smart Search Filtering

Kyle G asked on January 12, 2015 15:34

Hi there,

I have custom Page Types that have their own tables. I'm using a Smart Search Filter to grab these Page Types from the db, so I have a bunch of check boxes. When checked, I want to filter the results by NodeParentID and the value of the checkbox. But the problem is, my custom Page Type tables do not include NodeParentID, only the combined view does.

So I was thinking of adding a new field to my page types called ParentID , make it searchable and have a default value of the parent's NodeID. I don't want the user to have to select anything or even see this field. I want to use code like the following but I'm not sure if you can do these sorts of operations in the DefaultValue property of a custom field:

CMS.CMSHelper.TreeHelper.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentDocument.NodeParentID).DocumentID

Any help would be appreciated!

Thanks

Recent Answers


Kyle G answered on January 13, 2015 19:38

Update: I found out how to add macros to the DefaultValue property of a field from reading this: https://docs.kentico.com/display/K8/Reference+-+Field+editor#Reference-Fieldeditor-Settingdefaultformfieldvaluesthroughmacros.

I tried {%cmscontext.currentdocumentparent.nodeid%} but it doesn't return a value. I also just used {% ParentID %} and it too is null. This doesn't make sense because the page I'm creating is nested under a parent container.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.