Reuse 1 ListView for both editable and read-only K2 SmartForms

This HTML snippets helps you save time by reusing your editable List View into your Read-only page by hiding add/edit/delete toolbars.

Very very useful for quickly churning out apps! 🙂

You can use the same ListView below (With the add/edit/delete buttons), into your read-only page.

Riva - ListView toolbar before

Do note that you still need to call the “Specify Edit State for View and Form Controls” rule. The only problem with OOTB is that it does not remove the buttons.

Riva - ListView ro

Hide the toolbar by adding the following snippet:

<style>.grid-toolbars, .grid-body .action-row{display:none;}</style>

NOTE: Warning, this removes the toolbars to all List Views in the form. Apply an extra selector to restrict to one list view only.

Cool tip: If you often use this script, add it as a variable in your environment library. next time, just drag and drop it into a datalabel, and you’re done!

Riva - ListView toolbar after

[In case you don’t know: How to insert html/js/css into a smartform]

2 thoughts on “Reuse 1 ListView for both editable and read-only K2 SmartForms

Add yours

  1. Hi, this is a great article. could you please show us how to add a selector so that we can hide the toolbar only on the selected control?
    AK

    Like

Leave a comment

Create a website or blog at WordPress.com

Up ↑