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
inline editing with local array and row edit
12/12/2008
00:10
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi,

I am tyring to setup a grid with data manipulation on the client using a local array. Any help with the following will be appreciated, as i don't seem to get it working or find any examples of the same.

1. Stop refresh/restore of the changed data on clicking on sort
2. Save changed data to local array
3. editRow does not seem to mark dirty cells as do inline editing of single cells using cellEdit: true
4. What is the structure of the return from getChangedCells('all');

Thank you,

Suresh

16/12/2008
02:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

1. What you mean with stop/refresh when sort. Data is sorted according

to the rules of sorting. If you do not wnant to sort, then you can

disable this.

2. Use the following methods - getDataIDs and getRowData methods

for this purpose.

3. Yes this is true. Will be supported in next releases.

4. As described in the documentation:

"Returns an array of the changed cells depending on method (string, default 'all'). When 'all' this method returns all the changed rows; when 'dirty' returns only the changed cells with the id of the row"

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.

16/12/2008
14:18
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

Thank you for the response. Let me clarify below on my issues

1. I would like to sort my data. However if i edit my data in the cell, i would like to retain the new data in my grid. Clicking on the column heading refreshes the data back to the original data and then sorts the data causing loss of my changed data

2. Will try the methods. thanks

3. ok

4. The description of the array is not clear to me. An example will help. Is the array structure a name value pair like [row_id, field_name, value].

Thank you once again,

Suresh

17/12/2008
11:41
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

1. It is very natural that the data must be saved first and then perform the sort. otherwiese what you recommend to do? Also this is a idea to add a event beforeSortCol - if this event return true we can sort otherwiese no. This will solve meybe your problem.

4. The array structure is:

result = [ {id:rowid1, name1:value11....},

{id:rowid2, name1:value21....},

...

]

where the name is the name from colModel

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/12/2008
13:33
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi,

Thanks again for the prompt response.

1. I was thinking there is a temporary object which stores the data in the grid along with changed data. That would allow sorting without saving the data.

I will use your suggestion on using eventbeforeSortCol to disable sorting upon edit.

2. I tried the getRowData method, but i don't seem to get any data back. Is there a working example posted anywhere in the demos?

3. Thanks. Will use it.

Glad to be using your widget,

Suresh

18/12/2008
06:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Before trying getRowData you should use getDataIDs - something like this

var rids = $("#mygrid").getDataIDs(); // this give you all ids in grid

for(var i=0;i<rids.length;i++) {

var currentrow = $("#mygrid").getRowData(rids[i]);

// here your code to appent currentrow in array

}

Hope this helps

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.

18/12/2008
13:43
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

Thanks for the code snippet. That was very helpful.

Now i am able to retrieve the required data.

/Suresh

18/12/2008
16:41
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Tony,

Is the code same for sub grid as well. I am having trouble getting it out of a sub grid. It works for the parent grid though.

Thanks,

Suresh

20/12/2008
03:28
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Do you mean grid as subgrid or pure subgrid? If you are in second case there are no methods to acces data from subgrid.If you are in first case this should work for the subgrid.

Best Regads

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.

22/12/2008
13:13
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

I am trying to edit data in subgrid (grid as subgrid). I am accessing the data using the name of the subgrid and the functions you mentioned. If the same functions are supported, i must be doing something wrong. Will try again.

Thank you,

Suresh

22/12/2008
18:50
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

Thanks. I was able to retrieve the data from subgrid as well. However, there seems to be an issue upon edit where the cell value within the subgrid is being set to the html text (e.g getRowData gives me <input class=editable id=2_Pos style=”width:99%” value=8 jQueryxx='249' > where it should have only given me 8

I noticed the same behaviour when i close the subgrid. The subgrid gets represented as a row with html code.

/Suresh

23/12/2008
04:30
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

To be a clear. getRowData does not work correct when the row is edited, since of the additionlly added contend. To obtain the data for edited row you should use the combination of the rowid and name from colmodel something like:

if you edit the row with id 2 then

jQuery("2_myname").val();

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.

23/12/2008
12:39
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

Hi Tony,

Thank you, that explains how to get the data from edited row.  I guess i will have to embed the logic to check for dirty cells and then make the appropriate call. Also, I guess this is the cause for the subgrid to be displayed as code upon edit...Seems like i will need some display logic here as well.  

Thanks for the help and Wish you all a very happy new year 2009.

happy holidays,

Suresh

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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