is-it-possible-to-make-an-entire-grid-read-only

Questionsis-it-possible-to-make-an-entire-grid-read-only
Tony Wolsey asked 4 years ago

Hello Is it possible with a setting to easily make an entire grid read only?  Only want to allow readonly access based on user permissions. thanks Tony

4 Answers
Abu answered 4 years ago

You can try setting:

$opt[“readonly”] = true;
// …
$g->set_options($opt);

Let me know if you mean something else.

Tony Wolsey answered 4 years ago

Hi Abu

I have tried this and the grid/fields/content are still editable unfortunately.  I am looking for a way to make all fields readonly/uneditable on a page but still allow the autofilters, overall filtering, sorting and exporting to still work.

Sort of like protecting a page and allowing some visitors to only be able to view, filter, sort and export.

thanks

Tony

Tony Wolsey answered 4 years ago

Hi Abu

Any other ways to make this work?

thanks

Tony

Tony Wolsey answered 4 years ago

Hello

Just wanted to let you know that I figured out a solution for those who are interested.

I set two variables called $useraccess and $readonlyvar  based on user permissions for a page. I set the pages actions with $useraccess and each field’s “editrules readonly” parameter with the $readonlyvar variable. When the user accesses a page, if they only have permissions as a readonly user, many features will be hidden from them and each field will only be readonly/uneditable and appear as text in each field.”  They still have the ability to filter, sort, view, advanced filter, export, etc.

 

$g->set_actions(array(
“inline”=>true, // allow/disallow inline
“add”=>$useraccess, // allow/disallow add
“edit”=>$useraccess, // allow/disallow edit
“delete”=>$useraccess, // allow/disallow delete
“rowactions”=>true, // show/hide row wise edit/del/save option
“export_excel”=>true, // export excel button
“bulkedit”=>$useraccess, // allow/disallow edit
//”export_pdf”=>true, // export pdf button
“export_csv”=>true, // export csv button
“autofilter” => true, // show/hide autofilter for search
“showhidecolumns” => true, // show/hide columns
“search” => “advance”, // show single/multi field search condition (e.g. simple or advance)
“import” => $useraccess,
“clone”=>$useraccess // allow/disallow clone
)
);

 

$col[“editrules”] = array(“required”=>true,”readonly”=>$readonlyvar); // and is required

Your Answer

19 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?