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
gtting cell data on selectRow..
10/03/2010
14:02
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

Hi

On selectRow, i want to get the value of a certain column in that row only when the row is selected and use thatvalue to update another element.

As stated in the wiki /jqgridwiki/doku.php?id=wiki:methods

It urges you not to use getCell or getRowData as that does not return the value:

Do not use this method when you editing the row or cell. This will return the cell content and not the actuall value of the input element.

So What are my options for getting this to work?

I was thinking about 

var id = jQuery("#"+gridName).jqGrid('getGridParam','selrow');

var rowData = jQuery("#"+gridName).jqGrid('getRowData',id);//data of the row

var cellValueRfiNo = rowData.rfiLog.rfiNumber

 

But this doesnt work! (my column name is rfiLog.rfiNumber)

any ideas? thanks!

15/03/2010
20:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Could you please post the colModel, or better the entrie grid configuration.

Using FireBug you can easy determine what you have in rowData , just put this

console.log(rowData);

after the call and just look into the console how your rowData look.

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.

24/03/2010
22:49
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

Sometimes when I use console.log I get an error saying: console is not define. anyone know why?

However sometimes it does work.

When I console.log(rowData).. I get as follows for my columns..

genericLogDocument.description    "my description"
genericLogDocument.genericNumber "190"
rn "1"

When I console.log(rowData.genericLogDocument.genericNumber); I get this error: rowData.genericLogDocument is undefined

However if I console.log(rn) It prints out correctly .. in this case as 1.

It seems that the columns that are defined with a name like in this case genericLogDocument.genericNumber

    <sj:gridColumn name="genericLogDocument.genericNumber" index="genericLogDocumentNumberHeader"

I can!t get the value.

GenericLogDocument is an object which has an attribute genericNumber.       

any thoughts on this? Thanks.

03/04/2010
13:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello

Try to obtain the value this way

var cellValueRfiNo = rowData["rfiLog.rfiNumber"];

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.

07/04/2010
00:45
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

I tried your suggestion with another grid and what is alerted is not the data value but the actual make up for the cell contents

var cellValue = rowData["documentDistributor.companyName"];

alert(cellValue)... shows.....

<input class="editable" name="documentDistributor.companyName" id="2_documentDistributor.companyName" maxlength="50" size="50" type="text">

any further suggestion? :-)...  Its driving me nuts!..

08/04/2010
13:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If you look at you first post there is a text with red. This is what we mean .

Regards

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.

09/04/2010
14:13
Avatar
mikesmith
Member
Members
Forum Posts: 47
Member Since:
26/01/2010
sp_UserOfflineSmall Offline

Hi Tony

So How do I get data value from a row that is selected then when I have a column with a dot Notation?

surely it must be possible

14/04/2010
20:00
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

For me will be quiete easy if you explain me what you want to do.

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.

15/04/2010
12:15
Avatar
unknown
Member
Members
Forum Posts: 9
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

Hi guys,

I have nearly the same problem. I have a JQGrid where you can change a field in Cell Editing Mode. All is working fine. If a user now change the value in inline mode and take a click on the change button on the table (for Formediting-Mode), getRowData gave me (yes I know it stands in the documentation) the html input field. But what alternative I have?

Additionaly if a user change in celleditingmode the value and click an another row or cell that is not editable I want to display the new value in a html div block out of the jqgrid. So I have two functions formatCell and onSelectCell. Both do the same take the getRowData and display it in the div block. Same Problem I know the documentation but what is the alternative? If I use a hidden value the value would not be updated.

Any ideas Tony? Is there a changse to do something like Column-Editing to make a column editable? So I can ignore the div-block and the form-editing.

Greetings from Germany

Henning

15/04/2010
15:46
Avatar
unknown
Member
Members
Forum Posts: 9
Member Since:
01/04/2010
sp_UserOfflineSmall Offline

Hi again,

so I try a little bit to fix the problems with 2 Editing-Mods. If my Form is created I do the following in afterShowForm to get the right value from the Inline-Form:

            var val = $(\".edit-cell\").attr('title');
            $(".edit-cell").html(val);

But I didn't understand if I want the faild Input-Element, if I clicked on Change-Button, and the Inline-Edit-Cell is active to get the right value. In my case it is the Column BV_MENGE:

$("#tr_BV_MENGE td:nth-child(2)")

In this case I saw the Input-Html-Element but not the value that is in the Inline-Edit-Cell that is in the .edit-cell Element.

Greetings from Germany

Henning

21/03/2013
22:03
Avatar
Jelgab
New Member
Members
Forum Posts: 1
Member Since:
21/03/2013
sp_UserOfflineSmall Offline

In my case I needed the value of the cell during a row select event. I was also getting all that HTML mentioned in red but I was able to move move my code BEFORE I moved the row to edit mode. My code to get the cell value is:

grid.jqGrid("getCell", id, 1) //id is the id assigned to the row. 1 is the number of the column where the value is

All code:

Markup: <ClientSideEvents RowSelect = "editRow" />

Script:

var lastSelection;

function editRow(id) {

   if (id && id !== lastSelection) {

      var grid = jQuery("#myJQGridID");

      theCellValue = grid.jqGrid("getCell", id, 1);

      //First got the value. Now move to inline edit:

      grid.editRow(id, true);

      lastSelection = id;

   }

}

Fot others, maybe this little hack may work: 1. Temporarily get out of edit mode, 2. Get the cell value, 3. Move back to edit mode.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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