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
setRowData behavior
16/07/2008
14:43
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

I have a row in edit mode (editGridRow), then i do something like:

saveRowData(rowid,{

"col1":"hisval","col2",""

})

current row hav these two 2columns, and with this method i want to fill

only the first column, the second col must be filled by the user. But after i call the saveRowData this way the row is "closed" for editing after that

if i dont set secund col "col2" as "" (set only col1 value with saveRowData)

method there is no problem.

Greetings!

17/07/2008
02:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Should I mean that you want to set extraparams?

I suppose you have make typo here since the right syntax for saveRow

is

saveRow(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc)

Is the syntax for extraparams like this {col1:"hisval",col2:""} ?

or this {col1:"hisval",col2} which is wrong IMHO

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/07/2008
03:02
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Sorry i mean setRowData instead of saveRowData.

17/07/2008
03:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Could you please post your code here or send me to: tony at trirand.com?

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/07/2008
04:39
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

I have jqGrid with 3 columns,

1. id column,hidden

2. Name column text, not editable by user

3. Kind type combobox editable

on dbclick i set editRow for dbclicked row

i`m using setRowData as callback from other action to change the

name Name and id  column:

$("#gridid").setRowData($("#grid").getGridParam("selrow"),

{"id":"newid",

"Name":"NewName",

"Kind":"0"}

)

after this action current row is closed for editing by the setRowData.

  if i do:

$("#gridid").setRowData($("#grid").getGridParam("selrow"),

{"id":"newid",

"Name":"NewName",}

)

without set Kind column value

current row is not closed for edit wich is fine for me.

After playing a while with this behavior I noticed that if i set with

setRowData only the editable column (in my case Kind column wich is type"select") the row is closed for edit from himself again.

17/07/2008
05:23
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

When you call setRow - before or after editRow?

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/07/2008
05:56
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

After editRow function.

17/07/2008
06:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Could you please publish the full code in ondblClickRow event?

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/07/2008
06:18
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

I did not understand why but ...

ondblClickRow:function(rowid){
            $("#healthExpertGrid").editRow(rowid,false);
           
            $("#healthExpertGrid #"+rowid +" input,select").each(function(){
                $(this).attr("size","");
                $(this).css("width","96%");
                $(this).css("font-size","13px");
            })
            if($("#healthExpertGrid #"+rowid).attr("status")!=recInsert)
                    $("#healthExpertGrid #"+rowid).attr("status",recEdit);
            EditPerson();
            $("#container input,select,textarea").focus(function(){
                lastSelection = $(this).attr("id");
            })
            $("#healthExpertGrid #"+rowid).keyup(function(e){
                    var keyCode = e.keyCode || window.event.keyCode;
                    if(keyCode == 27){
                        $("#healthExpertGrid").restoreRow(rowid);
                        $("#healthExpertGrid #"+rowid).attr("status",recBrowse);
                    }
                });
        }

17/07/2008
06:57
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Do not see setRow instead. (Mybe you call it in EditPerson() function)

What I try to explain is:

If you call editRow on grid and after editRow you call setRow on same grid your data is overwritten by setRow the field has a flag editable,but with data that is overwritten - so you can anymore do edit an this until you not call

restoreRow.

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/07/2008
07:35
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

The thing that i want to explain is:

when i set new values of columns

with setRowData method and describe in this method all the columns

and theri values the row after that the row colsed himself(all inputs

and select are text which user can`t edit) if it was in 

edit mode(editRow) and I did not call SaveRow to do that.

Describes in my third  post.

17/07/2008
07:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Sorry maybe I do not understand.

So:

1. you call editRow;

(some fields are not editable and only Kind is editable)

2. you call setRowData(rowid,{”id”:”newid”,“Name”:”NewName”,

“Kind”:”0"}) right?

In this case the editable column Kind is overwritten with the value and it

is no more editable - right?

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/07/2008
07:58
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Yes, that is. And if i call

setRowData(rowid,{”id”:”newid”,“Name”:”NewName”)} that way,

without set value to kind the row is staying editable as it should be.

17/07/2008
08:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

This is expected behavior and not a bug. Let me try to explain:

The reason when you call this way

setRowData(rowid,{”id”:”newid”,“Name”:”NewName”)}

and all is ok is that these fields are not editable. As of the names of the

methods they operate per row and not per cell.

To work this you should set the row to be not editable after

setRowData something like

$("#rowid","#mygrid").attr("editable","0");

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/07/2008
08:07
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

But I 'm not sure if after this you will have the expected behavior.

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/07/2008
09:10
Avatar
julizar
julizar
Member
Members
Forum Posts: 32
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

I did not want to set row to be "not editable" after SetRowData,

there is a saveRow method to do that.

19/07/2008
16:50
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

I think I might have a similar situation. I have two columns — account and amount — in a grid where the rows represent the parts of an accounting transaction. When I add a row, the user selects an account and my javascript code then calculates what the amount would have to be based on all the other rows (it tries to force a balance across all rows in this transaction). It then sets the amount cell to this calculated amount. 

But it is possible that the user does not want all of the outstanding amount to go to this account, so he (or she) has to be able to edit the amount before saving the row.

What happens is, the javascript calculates the balance, then uses

           $('#tblwriteoff').setRowData(id,{ 'amount':num } );

to set the amount column on this row to the balance and the cell, which previously was editable (before I selected the account), no longer is.

So I tried

           $('#' + id + '_amount').val(num);

and this is even worse; now the amount does not hold its value.

After that I tried

           $('#tblwriteoff').setCell(id,'amount',num);

and still no joy. The amount is there but the cell is not editable. WHen I save the row (I am using keys:true so I press enter when the cursor is in the account cell) the amount data disappears.

Am I doing something wrong and one of these should work, or is the cell going to be not editable whatever I do?

And if so, what do you suggest for pre-populating a cell and still leaving it editable?

Thanks,

Reg
 

20/07/2008
04:37
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Maybe I will explain this in detail.

1. When the grid is constructed we have something like:

...

<tr id='123'><td>myval</td>..</tr>

...

After editRow we have

<tr id='123'>

<td><input id='123_myname' ..val='myval' /></td>...

</tr>

So when we call after this setRowData the entry input tag is replaced with the value from setRowData.

Now - one possible solution is those from Reg

$("#"+id+"_myname","#mygrid").val("newvaluehere")

Another solution is to write additional method which will act to this case

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.

20/07/2008
09:03
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

Thank you Tony,

That fixes that problem beautifully. What I was missing was the mention of the grid_id. Is this something that should go into the docs somewhere or is it a jQuery feature that everyone (except beginners like me) will know about?

Thanks again

Reg

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