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
Local Array and rowid
18/06/2009
23:06
Avatar
Romyn
Member
Members
Forum Posts: 45
Member Since:
13/06/2009
sp_UserOfflineSmall Offline

Hi,

Been searching for a while and am getting closer but think it's time to ask for help on this one.

I have a grid I fill with initial values from a local array. While I'd like to set the rowid to the same as the array's index for each row it seems that it's not possible to set the first one as rowid=0 so I've got used to the idea of having rowid = array_index +1. (If it is possible to synch them together that would be great).

However that's not really the main question. I've run into the issue of the rowid being set to +1 from the rowcount when adding a new row via editGridRow(new) and if I've deleted a row before I get duplicate rowids.

It seems I should be using AfterSubmit but I'm not sure how or whether that would work for local data. What I want to do is set the rowid for the new record to a specific number. Can someone help me as to how this should be done.

Also will this new rowid be the one that would be used in the subsequent afterInsertRow function I have - or will it be the one that is automatically assigned?

Hope that makes sense and someone will take pity on my hopelessness.

Thanks

Romyn

21/06/2009
06:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello Romyn,

Thanks again for your investigationns.

Also you are right there is a problem when we want to insert rowid = 0 in addRowData method. Also corrected in GitHub. Thanks.

Now about your problem.

IMHO it is a good idea in your case to have a global counter for the length of the rows in the grid. That is after you insert the data you can do

mycounter = myarray.length, where the myarray is a data added in the grid.

Then you can use afterSubmit event like this

afterSubmit : function (data, postdata) {

mycounter++;

return [true,"",myconter];

}

This way you will have in all cases uniquie id instead that you delete something from the grid.

Best 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.

27/06/2009
13:08
Avatar
Romyn
Member
Members
Forum Posts: 45
Member Since:
13/06/2009
sp_UserOfflineSmall Offline

Thanks for that Tony - all working now with id=0 etc.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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