Add Custom Filter Control In CMSDesk Listing Mode

hadi tag asked on April 15, 2015 06:00

hi

i use from kentico 81 i want search in all document on my page(listing menu) by Published field. how to add Published field for search on document listing?

Recent Answers


Brenden Kehren answered on April 15, 2015 13:51

Short answer is within the Admin interface you'd need to modify the base control/page to have this field added to the filter, I'd suggest a simple non-coding solution and just sort by the "Published" column.

Now for the long answer and an alternative way, take a look in this file:

/CMSModules/Content/CMSDesk/View/listing.aspx

In there you'll see the following control referenced:

/CMSModules/Content/Controls/DocumentList.ascx

In that control's code behind you can see the following filters are referenced:

cms.document.simplefilter
cms.document.filter

Now if you go into the Modules app and go to Pages>Alternative forms you'll see the Listing filter and Listing filter (simple). You'd think you'd be able to simply add the "Published" field in there, well that won't work because there isn't a "Published" field in the cms_document or cms_tree classes (I believe it's a calculated field). To get that specific "Published" field, you would have to modify some code to get it on the filter which I'd not recommend, but if you really need it, start coding!

Yet another non-coding solution would be to add the DocumentPublishFrom and DocumentPublishTo fields to the alternative form. This will allow them to search a date range if the sorting by "Published" doesn't work.

Good luck!

0 votesVote for this answer Mark as a Correct answer

hadi tag answered on April 15, 2015 14:40

Thanks for the reply you gave

But because I am using a workflow on the site, the administrator would be able to search based on the publication, document that users have registered , And those that have not been published yet published

Is there another solution?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 15, 2015 18:19

In the Page class there is a DocumentWorkflowStepID field. You could add this to the filter and dynamically query the workflow step table (CMS_WorkflowStep) and get all the steps based on the workflow (CMS_Workflow) you want to filter by. Otherwise I'd think you need to use the coding option I provided and modify the base control(s).

0 votesVote for this answer Mark as a Correct answer

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