Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqgrid and user rights.
19/04/2010
11:58
Avatar
lorife
Member
Members
Forum Posts: 15
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

Hi,

I'm using php and a mysql db to manage user login in my website.

For now, just administrators can login in the website, so in PHP i can check if they are logged in using:

if($session->logged_in){

}

I'm using the file mycustom.js to load create the jqgrid like this:

jQuery(document).ready(function(){

jQuery("#griglia-negozi").jqGrid('navGrid','#pager-griglia-negozi', {refresh: true, edit: false, add: false, del: false,

search:false},{},{},{},{multipleSearch:true, closeAfterSearch: true, closeOnEscape: true},{});

);

the problem is that I would like the grid to be editable if a user is logged in, but I don't know how to integrate a php "if clause" in the file mycustom.js to achieve something like:

<?php

if($session->logged_in){

?>

jQuery(document).ready(function(){

jQuery("#griglia-negozi").jqGrid('navGrid','#pager-griglia-negozi', {refresh: true, edit: false, add: false, del: false,

search:false},{},{},{},{multipleSearch:true, closeAfterSearch: true, closeOnEscape: true},{});

);

<?php

} else

{

?>

jQuery(document).ready(function(){

jQuery("#griglia-negozi").jqGrid('navGrid','#pager-griglia-negozi', {refresh: true, edit: true, add: true, del: true,

search:true},{},{},{},{multipleSearch:true, closeAfterSearch: true, closeOnEscape: true},{});

);

<?php

?>

Could you help me?

thank you,

Lorenzo

21/04/2010
14:40
Avatar
lorife
Member
Members
Forum Posts: 15
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

Anybody can help me, please?

26/04/2010
13:31
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I do not think it is a jqGrid problem. Just a opinion

Maybe you will need to define somethings like this

$grid1 = <<<GRID1

here first code

GRID1

$grid2 = <<<GRID2

here second code

GRID2;

And the echo the $grid1 and $grid2 depending on conditions

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

26/04/2010
13:46
Avatar
lorife
Member
Members
Forum Posts: 15
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

Hi Tony, 

thank you for answering. No, it's not a jqgrid problem, the grid works perfectly.It's just that I am not able to change the possibility to edit/insert/delete records AFTER the grid creation.

So you are saying I should create 2 grids identical, one which I can edit and the other locked and then decide which one to show depending if the user is logged or not?

Isn't there a way to link to the grid from php and just change the property of the grid?

Sorry if the question is stupid, I'm very new in web programming. It would be great if you could provide me with a couple of detailed lines..I can't find any example anywhere..

btw, thank you so much for this great grid!

Thank you so much,

Lorenzo

26/04/2010
15:49
Avatar
lorife
Member
Members
Forum Posts: 15
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

I made it!

in the php file, when the user logs in I set a JS variable vIsAdmin="TRUE".

in the file mycustom.js I check that variable and i create the pager accordingly.

Probably there is a better way to do it, but this way it works too....

Lorenzo

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
111 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information