Forum


23:47

19/01/2010

This is my code
jQuery("#list").jqGrid('navButtonAdd','#navigator',{
caption:"Clone",
onClickButton:function(){
var gsr = jQuery("#list").jqGrid('getGridParam','selrow');
if(gsr){
var data = jQuery("#list").jqGrid('getRowData',gsr);
alert(data.name);
var datarow = {
name:data.name
};
var su=jQuery("#list").jqGrid('addRowData',"_empty",datarow);
if(su){
}else{
alert("Can not update");
}
} else {
alert("Please select Row")
}
}
});
the alert print:
<input class="editable" name="name" id="18_name" style="width: 98%;" type="text">
but it should be print only a name
why this?
19:04

Moderators
30/10/2007

Hello,
This situation is described here with red text:
http://www.trirand.com/jqgridw.....ki:methods
Best Regsrds
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:28

Moderators
30/10/2007

Hello,
If you have puted custom input tags in the grid you should expect these tags from getRowData.
Note that this can not be avoided. Imagine if we not have input, but some other html content - How can we make decision which is the value.
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.
18:33

Moderators
30/10/2007

Hello,
Then from where is this input tag? Into the code provide from you I do not see any method from inline edit
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:03

19/01/2010

Here is my complete code
onSelectRow: function(ids) {
var data = jQuery("#list").jqGrid('getRowData',ids);
if(ids && ids!==lastsel2){
jQuery('#list').restoreRow(lastsel2);
jQuery('#list').jqGrid('editRow',ids,true);
lastsel2=ids;
},
pager: '#navigator',
height: 'auto',
width:'auto',
rowNum:15,
rowList:[15,20,50],
sortname: 'id',
viewrecords: true,
sortorder: "asc",
multiselect: true,
editurl: "submit.php?function=reductions&build_id=<?=$build_id;?>",
caption: 'Offerte',
loadError : function(xhr,st,err) { jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText); }
});
jQuery("#list").jqGrid('navButtonAdd','#navigator',{
caption:"Clona",
onClickButton:function(){
var gsr = jQuery("#list").jqGrid('getGridParam','selrow');
if(gsr){
var data = jQuery("#list").jqGrid('getRowData',gsr);
alert(data.price);
var datarow = {price:"430.00"};
var su=jQuery("#list").jqGrid('addRowData',"_empty",datarow);
if(su){
}else{
alert("Can not update");
}
} else {
alert("Please select Row")
}
}
});
09:38

Moderators
30/10/2007

Hello,
You can not do this as described in the docs.
Best Regsrds
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.
21:04

02/02/2010

Okay, we've come across a solution.
The problem is when the editable field of the column is set to true, the *value* of the cell changes to html, because it's now editable.
ie wheras before you might have had column "Age":"16",
when it is being edited, the value "16" changes to <input type="textbox" id="bla" etc>, and this is what is pulled out by getRowData(...).
if you're not sure what i mean, switch the column property editable:true -> editable:false and then call getRowData(...) you'll see the actual value pop up.
this frustrated me for about 3 hours this afternoon, someone only just pointed out to me what was up 😀
from here i'm going to try to figure out how to use jquery/jqgrid to change the editable property of the field to false before i call getRowData
18:14

02/02/2010

What we did is we took the editRow(...) call from the "onRowSelect" event. Instead we now have to click on a button to edit the row.
By taking the editRow out of the event and making it explicit that you have to click the button to edit the row, when you call getRowData(...) it will actually return the value of the field, rather than the html of the input box.
the idea is that when you call getRowData the field is in fact not editable. However you have edited it before so the edited data is there.
Here's the code we used:
colModel :[
{width:45, name:'Act' , index:'Act' , editable:false},
{name:'RecordID' , index:'RecordID' , editable:true, hidden:true},
{name:'Date' , index:'Date' , editable:true, hidden:true},
{name:'IP' , index:'IP' , editable:true, hidden:true},
{name:'Student_First_Name', index:'Student_First_Name', editable:true},
{name:'Student_Last_Name' , index:'Student_Last_Name' , editable:true},
{name:'Class' , index:'Class' , editable:true, hidden:true},
{width:250, name:'Teacher_Name' , index:'Teacher_Name' , editable:true},
{width:580, name:'School_Name' , index:'School_Name' , editable:true},
{name:'Location' , index:'Location' , editable:true},
{name:'PG_First_Name' , index:'PG_First_Name' , editable:true},
{width:200,name:'PG_Last_Name' , index:'PG_Last_Name' , editable:true},
{width:380, name:'Email' , index:'Email' , editable:true},
{name:'Relationship' , index:'Relationship' , editable:true, hidden:true},
{name:'Phone' , index:'Phone' , editable:true} ],
onSelectRow: function(id){
if(id && id!==lastsel){
$('#scrub').saveRow(lastsel);
lastsel=id;
}
},
//this creates a button that we can click to make the row editable
gridComplete: function(){
var ids = jQuery("#scrub").jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
var cl = ids[i];
be = "<input style='height:22px;width:13px;' type='button' value='E' onclick="jQuery('#scrub').editRow('"+cl+"', true);" />";
$("#scrub").jqGrid('setRowData',ids[i],{Act:be});
}
},
then below we've defined a save button, which then calls getRowData, which is the value we need.
03:00

14/05/2010

I found a workaround for similar issue. I add a condition to check if getRowData returns INPUT control or valid data. If getRowData returns control then I use jquery to locate this INPUT control and get value directly from the control (i.e.)
var objRowData = someGrid.getRowData(cl);
if (objRowData.price.indexOf("input") != -1) {
console.info("trick", $("#1_price").val());
}
Most Users Ever Online: 715
Currently Online:
52 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66