View only, no edit

QuestionsView only, no edit
Daniel asked 6 years ago

I'm looking for a gridview that can show (with all features like search, filter, export,…) data from a Mysql view (no table)
There will be no primary key, no insert,…
Is this possible with this grid control?

1 Answers
anavarro answered 6 years ago

Yes, that's possible with PHPGrid.

Since your view doesn't have a PK, I sugest that you define your select in the select command like this:

SELECT @id := @id + 1 AS rowid, v.*
FROM viewname v JOIN (SELECT @id := 0) as foo

With that, your select will auto numerate your rows, creating an id for each row in your view.

And in your set_actions use this:

$g->set_actions(array(
"add"=>false,
"edit"=>false,
"delete"=>false,
"rowactions"=>false,
"export"=>true,
"view"=>false,
"autofilter"=>true,
"search"=>"advance")
);

Your grid will not have an add, edit or delete options, just the search and filter options.

Your Answer

16 + 1 =

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. Vote count:

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

Let us improve this post!