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
why i get html by getRowData
18/01/2010
23:47
Avatar
napster3000
Member
Members
Forum Posts: 4
Member Since:
19/01/2010
sp_UserOfflineSmall Offline

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_nameFrown" style="width: 98%;" type="text">

but it should be print only a name

why this?

24/01/2010
19:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

24/01/2010
20:41
Avatar
napster3000
Member
Members
Forum Posts: 4
Member Since:
19/01/2010
sp_UserOfflineSmall Offline

Yes, but what's the right method to use to get row data value?

26/01/2010
17:28
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

26/01/2010
17:32
Avatar
napster3000
Guest
Guests

No, i have not put custom input  tags.

How i get a value of a field by rowid?? HELP ME!

26/01/2010
18:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

29/01/2010
23:03
Avatar
napster3000
Member
Members
Forum Posts: 4
Member Since:
19/01/2010
sp_UserOfflineSmall Offline

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")
           }
        }
   });

01/02/2010
09:38
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

02/02/2010
20:47
Avatar
cchmatthew
Member
Members
Forum Posts: 3
Member Since:
02/02/2010
sp_UserOfflineSmall Offline

Hi,

  This was confusing me as well. If we can't use the getRowData to return the actual value instead of the HTML, how then does one select the values of a row from the table given a specific rowID?

02/02/2010
21:04
Avatar
cchmatthew
Member
Members
Forum Posts: 3
Member Since:
02/02/2010
sp_UserOfflineSmall Offline

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

02/02/2010
22:13
Avatar
napster3000
Member
Members
Forum Posts: 4
Member Since:
19/01/2010
sp_UserOfflineSmall Offline

Yes but if I edit the "editable" in false, then I will edit the line.

I want to make it editable online and get that value through GetRowData ()

03/02/2010
18:14
Avatar
cchmatthew
Member
Members
Forum Posts: 3
Member Since:
02/02/2010
sp_UserOfflineSmall Offline

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.

14/05/2010
03:00
Avatar
maximity
New Member
Members
Forum Posts: 1
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

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());

}

03/02/2012
16:22
Avatar
wizrd66
Member
Members
Forum Posts: 4
Member Since:
28/01/2012
sp_UserOfflineSmall Offline

I have noticed that sometimes even when you call Getrowdata before and edit you still get the input tags....

If you do a getrowData and then do an editRow .. Sometimes the Edit row happens first

Forum Timezone: Europe/Sofia

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

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information