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
Call a function from gridComplete?
Tags: function
04/05/2010
23:54
Avatar
w4ik
New Member
Members
Forum Posts: 1
Member Since:
04/05/2010
sp_UserOfflineSmall Offline

-----------------------------------------------------------------------------------------------------------------------------------

Check here for the answer

http://stackoverflow.com/quest.....04#2774104

-----------------------------------------------------------------------------------------------------------------------------------

I'm trying to call a function in the onClick event of the button that is created during the gridComplete function..Loads OK…here's what the rendered html looks like for the button in the first row

<input type="button" onclick="deleteRow(9197113);" value="Delete" style="height: 22px; width: 70px;">

but when i click the button…the function is not called and firebug says….

deleteRow is not defined

How can I call a function, rather than having inline javascript,,,(which does work BTW, but I  would like to call the function for readability and maintainability).

Below is the grid Complete portion of the jqGrid settings.

jQuery("#list").jqGrid({

       ………………….

        gridComplete: function() {
            var ids = jQuery("#list").jqGrid('getDataIDs');
            for (var i = 0; i < ids.length; i++) {
                var cl = ids[i];
                de = "<input style='height:22px;width:70px;' type='button' value='Delete' onclick='deleteRow('" + cl + "' );' />";               
                jQuery("#list").jqGrid('setRowData', ids[i], { Delete: de });
            }
        }

       ………………….

 });

Here's the deleteRow() function…

    function deleteRow() {
        alert("hit delete button");
        // jQuery("#grid_id").jqGrid('delGridRow', row_id_s,options );
    }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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