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_Related Related Topics sp_TopicIcon
JQgrid - conditional display of edit dialog
24/08/2013
00:49
Avatar
rajeshj_18
United States
Member
Members
Forum Posts: 5
Member Since:
23/08/2013
sp_UserOfflineSmall Offline

Hi,

i am new to jqgrid and after searching out for lot of examples, i got a grid loading and working fine.  I have the edit button in the navGrid.  when i select a row and click edit, the edit dialog is popping up.

but i want to control this action.  i want the edit dialog to show up only when some condition meets.  condition can be like a variable being set in database or javascript.

is it possible?

my code is like below

..}).jqGrid('navGrid','#pager',{},editSettings,addSettings,delSettings,…

editSettings = {

onclickSubmit:onclickSubmitLocal                    closeAfterEdit:true,                    savekey: [true,13],                    closeOnEscape:true,                    reloadAfterSubmit:false, jqModal:false,

                }                    

basically i have two buttons on my page - "Lock for edit" and "unlock".  if the user wants to make any change, they shd first lock the table, so that it is visible to others in read only mode.  so without clicking "lock for edit" button, they shd not be able to edit or delete the rows.  how do i do it?

please help.

Thanks.

24/08/2013
01:44
Avatar
rajeshj_18
United States
Member
Members
Forum Posts: 5
Member Since:
23/08/2013
sp_UserOfflineSmall Offline

fixed this by using below code

var grid = $("#list"); var gid = $.jgrid.jqID(grid[0].id); var $td; if (isLocked == false) { $td = $('#add_' + gid); $td.hide(); $td = $('#edit_' + gid); $td.hide(); $td = $('#del_' + gid); $td.hide(); //$('#pager_left').attr({ style: ["display:none"] }) } else { $td = $('#add_' + gid); $td.show(); $td = $('#edit_' + gid); $td.show(); $td = $('#del_' + gid); $td.show(); //$('#pager_left').attr({ style: ["display:inline"].join(' ') }) }

25/08/2013
11:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Why so complex? There is a very elegant solution if you use beforeInitData event. You will need just to look at /jqgridwiki/doku.php?id=wiki:form_editing&s[]=beforeinitdata

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
30 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