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
add empty row?
16/02/2009
15:28
Avatar
spectrus
Member
Members
Forum Posts: 8
Member Since:
10/02/2009
sp_UserOfflineSmall Offline

Hello,

Is there a simple straightforward way to append an empty row to the end of the grid? I want to make sure that it's the same height on all the pages, even if the number of results returned for last page is smaller than the current number of rows per page.

Thanks!

16/02/2009
15:49
Avatar
cartman
Member
Members
Forum Posts: 18
Member Since:
14/02/2009
sp_UserOfflineSmall Offline

Easy, just fill a variable with all blanks then append using addRowData.

You may want to use getDataIDs to obtain the last rowid.

var datarow = {id:'',.....(all your columns here)};
var su=jQuery("#grid").addRowData(lastrowid+1,datarow);

16/02/2009
16:03
Avatar
spectrus
Member
Members
Forum Posts: 8
Member Since:
10/02/2009
sp_UserOfflineSmall Offline

Yes, I was aware of the addRowData function. But what if I don't have the info on the columns? Can I get that information somehow? I tried getColProp(), but that just gives back and object that has no properties in Firebug.

Edit: Oh, right, never mind the bit about getColProp, just clued in that I have to supply it with a column name. Still looking for a way to get the number of columns of an existing grid.

Thank you!

16/02/2009
18:02
Avatar
cartman
Member
Members
Forum Posts: 18
Member Since:
14/02/2009
sp_UserOfflineSmall Offline

Another easy one!

To get all the column names just parse the row array from getRowData like this:

row_array = getRowData(anyrowid);

for ( var column in row_array)  {
   // column contains the name of the column, put your code here
}

17/02/2009
01:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If you put empty string for the rowid (or false) you row will have the id = totalrecords_in_grid + 1;

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.

17/02/2009
10:28
Avatar
spectrus
Member
Members
Forum Posts: 8
Member Since:
10/02/2009
sp_UserOfflineSmall Offline

Thank you both very much!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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