Forum

July 12th, 2025
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
Delete table content?
17/02/2011
14:28
Avatar
emo.antonov
Sofia, Bulgaria
Member
Members
Forum Posts: 19
Member Since:
16/06/2010
sp_UserOfflineSmall Offline

Hello guys. I am using jqgrid to create dinamic tables with datatype: "local". But i saw something strange: instead of replacing rows the grid is appending new results. So i was wondering is there a way to flush table content before add new data?

Thanks in advance!

17/02/2011
14:44
Avatar
emo.antonov
Sofia, Bulgaria
Member
Members
Forum Posts: 19
Member Since:
16/06/2010
sp_UserOfflineSmall Offline

I just try something like this:

GridUnload(jQuery("#maygrid"));

for(var i = 0; i <= data.length; i++)
                    jQuery("#maygrid").jqGrid('addRowData', i+1, data[i]);

And the grid was empty, but not pre filled.

17/02/2011
15:07
Avatar
emo.antonov
Sofia, Bulgaria
Member
Members
Forum Posts: 19
Member Since:
16/06/2010
sp_UserOfflineSmall Offline

It was my mistake by using GridUnload. This is the correct way:

jQuery("#maygrid").jqGrid('GridUnload');

But no matter that now the result in firebug is:

u.p is undefined

17/02/2011
15:49
Avatar
emo.antonov
Sofia, Bulgaria
Member
Members
Forum Posts: 19
Member Since:
16/06/2010
sp_UserOfflineSmall Offline

grid.custom.js is loaded after jquery.jqGrid.min.js (I've try before and after and still the same Confused)

21/02/2011
09:34
Avatar
emo.antonov
Sofia, Bulgaria
Member
Members
Forum Posts: 19
Member Since:
16/06/2010
sp_UserOfflineSmall Offline

OK if someone have the same situation like me here is the solution:

- I made function for grid initialization:

function constructGrid(){
        $("#mygrid").jqGrid('GridUnload');
        jQuery("#mygrid").jqGrid({
            datatype: "local",
            height: 200,
            colNames:['One', 'Two', 'Three', 'Four','Five'],
            colModel:[
                {name:'col1',index:'col1', width:100},
                {name:'col2',index:'col2', width:100},
                {name:'col3',index:'col3', width:100},
                {name:'col4',index:'col4', width:100},
                {name:'col5',index:'col5', width:100}
            ],
            viewrecords: true,
            caption: "Some Caption"
        });
    }

- on document.ready – call :

constructGrid();

- on callback function which returns new data:

success: function(data){
                constructGrid();
                for(var i = 0; i <= data.length; i++)
                    jQuery("#mygrid").jqGrid('addRowData', i+1, data[i]);
            }

And that works for me.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

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