jQuery UI Widgets › Forums › Grid › grid refreshing
Tagged: javascript grid, jquery grid, refreshdata
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 9 years, 6 months ago.
-
Authorgrid refreshing Posts
-
Hi I have read all the topics around this and none gives me a solution.
Basically. I have a javascript page with jqxdropdownlist and jqxgrid. On changing the select of the dropdownlist we make around trip to the server to get a json string to populate the grid….except it dosn’t.
Here is the code
=============================================================
// JavaScript Document
$(document).ready(function (e) {form.initialise();
});
var gridData = [{“pkid”:”1″,”pageid”:”100″,”widgetid”:”20151ddsss025084346f97c246b-9b14-415d-9320-e2e70ef117ba”,”widgettype”:”jqxButton “,”selector”:”btnsave”}];
var form = {
source : null,
dataGridAdapter : null,
initialise : function () {
form.source = {
localdata : gridData,
datafields : [{
name : ‘pkid’,
type : ‘string’
}, {
name : ‘pageid’,
type : ‘string’
}, {
name : ‘widgetid’,
type : ‘string’
}, {
name : ‘widgettype’,
type : ‘string’
}, {
name : ‘selector’,
type : ‘string’
},
],
datatype : “json”
};form.dataGridAdapter = new $.jqx.dataAdapter(form.source);
$(“#jqxgrid”).jqxGrid({
width : ‘100%’,
source : form.dataGridAdapter,
columnsresize : true,
sortable : true,
columns : [{
text : ‘Code’,
datafield : ‘pkid’,
width : ‘10%’
}, {
text : ‘Widget Id’,
datafield : ‘widgetid’,
width : ‘80%’
}, {
text : ‘Widget Type’,
datafield : ‘widgettype’,
width : ‘10%’
}]
});$(“#pageselect”).jqxDropDownList({
source : selectPageData,
selectedIndex : 1,
width : ‘200’,
height : ’25’
});
$(‘#pageselect’).on(‘select’, function (event) {
var args = event.args;
var item = $(‘#pageselect’).jqxDropDownList(‘getItem’, args.index);
if (item != null) {
form.listComponents(item.value);
}
});
},
listComponents : function (page) {
var dat = {};
dat.action = “pagecomponentlist”;
dat.page = page;
$.post(“JqxWidgetMaker”, dat,
function (data, status) {
form.source = $.trim(data);
form.dataGridAdapter.dataBind();
$(“#jqxgrid”).jqxGrid(“updatebounddata”);
});}
}
============================ end of code
when data is examined following the $.post it returns the following string “[{“pkid”:”1″,”pageid”:”10″,”widgetid”:”20151025084346f97c246b-9b14-415d-9320-e2e70ef117ba”,”widgettype”:”jqxGrid “,”selector”:”gridComponentList”}]”
I have various combinations updatebounddata refreshdata etc with no effect.Ed…..
Hi edhrx,
The data in your form.source is never updated so the Grid’s adapter is using only old data. The localdata param should be updated. I suggest you to look at :http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/refreshdata.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.