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
calling setRowData then sorting the table.
25/10/2010
22:32
Avatar
vrtinch
Member
Members
Forum Posts: 4
Member Since:
25/10/2010
sp_UserOfflineSmall Offline

When using setRowData

The data is updated properly in the table until you sort.

THen the data goes back to what it was originally before setRowData was called.

27/10/2010
16:49
Avatar
vrtinch
Member
Members
Forum Posts: 4
Member Since:
25/10/2010
sp_UserOfflineSmall Offline

I tried working around this issue by deleting and adding the edited row back to the table. The results were just as bad.

After running the following commands

/******Start Commands

console.log($('#435_ListingHistoryTable').jqGrid('getGridParam','data')); // Data Before editing

var Data = $('#435_ListingHistoryTable').jqGrid('getRowData',997);
$('#435_ListingHistoryTable').jqGrid('delRowData',997);

console.log($('#435_ListingHistoryTable').jqGrid('getGridParam','data'));// Data after delete

Data.Notes = 'YES DOIN FINE';

$('#435_ListingHistoryTable').jqGrid('addRowData',997, Data);

console.log($('#435_ListingHistoryTable').jqGrid('getGridParam','data'));// Data after add

/******End Commands

I get the following results in firebug

/*****Start results

// Data Before editing

//Data after delete
//Data after add
/******End results
Notice that even though I asked it to delete ID=997 it decided to delete 1000 instead. So in the end I ended up with two rows with 997 as the ID and no row with 1000 as the ID.
Table definition is as follows:
jQuery('#435_ListingHistoryTable').jqGrid({
    datatype: 'local',
    colNames:[
         'ID'
        ,''
        ,'Date'
        ,'Price'
        ,'History type'
        ,'Notes'
    ],
    colModel :[
         {name:'ID',hidden:true, key:true}
        ,{name:'LoadIcon',hidden:true,width:16}
        ,{name:'Date',width:65,sorttype:'date',datefmt:'m/d/Y'}
        ,{name:'Price',width:80}
        ,{name:'Type',width:134}
        ,{name:'Notes',width:275}],    
    gridComplete: function(){
            
    },
    ondblClickRow: function(selectedRow) {
            
    },
    rowNum: 999999,  
    width: 554,
    height:'116',
    altRows: true,  
    altclass: 'TableAlternate'
});
Any help is appreciated.
27/10/2010
16:58
Avatar
vrtinch
Member
Members
Forum Posts: 4
Member Since:
25/10/2010
sp_UserOfflineSmall Offline

forgot to mention that in the above attempt the GUI looked as if everything was done correctly until I sorted which then revealed the bad underlying data.

27/10/2010
20:08
Avatar
vrtinch
Member
Members
Forum Posts: 4
Member Since:
25/10/2010
sp_UserOfflineSmall Offline

So I found a work around.

It appears the underlying issue was in the GridParam Data not being updated correctly.

So instead of calling the setRowData command I wrote a little function that updated the underlying data and reloaded the grid.

Seems to work fine so far.

console.log($('#435_ListingHistoryTable').jqGrid('getGridParam','data'));

var Data = $('#435_ListingHistoryTable').jqGrid('getGridParam','data');

var RowData = $('#435_ListingHistoryTable').jqGrid('getRowData',997);

for(var i in Data ){
  if (Data[i].ID == RowData.ID){
    Data[i].Notes = '1 Already Done';
    break;
  }
}

$('#435_ListingHistoryTable').jqGrid('setGridParam','data', Data).trigger("reloadGrid");
console.log($('#435_ListingHistoryTable').jqGrid('getGridParam','data'));

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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