Hey,
That title was a bit of a mouthful. I'll try again. What if you have a list of records in a Model Driven App and you want to sort the view by one column, but you also don't want that column in the view as it could be seen as a distraction or not required.
Well this is where this blog post comes in.
The existing view
Above is our current view, it shows some post titles; published date; post views and unique visitors.
Say we have a marketing team that are looking at these blog posts, they might not really need to see the post views, but would like to still order by the post views. This is not possible to do when editing the view in the normal way.
Model Driven App Sorting
In the view below, we can see that we have sorted, the view by Post views (descending):
If we now remove the Post views column, we are not able to sort by that column. You can see that from the screenshot below.
The "fix"
We have our solution in a DEV environment currently. Let's put the column - Post views back into the view, and also back into the sort by:
Next, lets create a new solution, add the Post table, and the Active Posts view:
Next, lets export this as unmanaged. Save the solution somewhere, and then extract it and open the customizations.xml file:
In this file, we can see a few things. Views are basically fetch XML queries. We have the <layoutxml> and <fetchxml> areas. As we don't need the Post Views or Unique visitors columns, we can remove them from the cell name and attribute name sections. Those lines have been removed as per the screenshot below:
Next, we need to save the customizations.xml file and zip back up the three files we unzipped earlier, and import that solution back into the DEV environment, this will update the customizations file, and the view.
Go into this separate solution and click Publish all cutomisations. Then you can refresh the view in the model driven app, and hey presto - The posts are in the same order, but without the Post views or unique visitor columns, but still retaining the sort by Post views.
Thanks for reading, as always if you need anything please add a comment on this post or email me - jon@jondoesflow.com.
Comentários