jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jgrid call again not display
Tagged: destroy, grid, initialize, jqxgrid
This topic contains 2 replies, has 2 voices, and was last updated by Dimitar 11 years, 7 months ago.
-
Author
-
Hi All,
– I study jqwidgets. I using jgrid. But not problem show data.
– Step I call function load jgrid it work. After I call function other load data to $(‘#jqxgrid’).html(‘dfd’).
– I call function load jgrid again. then it not work.
– Please help.
See code :
-$(document).ready(function () {
data();
});
function data()
{
var theme = getDemoTheme();
var source =
{
datatype: “json”,
datafields: [
{ name: ‘CompanyName’},
{ name: ‘ContactName’},
{ name: ‘ContactTitle’},
{ name: ‘Address’},
{ name: ‘City’}
],
url: ‘grid_data.php’,
cache: true,
async: true
};var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
source: source,
theme: theme,
columns: [
{ text: ‘Company Name’, datafield: ‘CompanyName’, width: 250},
{ text: ‘ContactName’, datafield: ‘ContactName’, width: 150 },
{ text: ‘Contact Title’, datafield: ‘ContactTitle’, width: 180 },
{ text: ‘Address’, datafield: ‘Address’, width: 200 },
{ text: ‘City’, datafield: ‘City’, width: 120 }
]
});}
function datahtml()
{
$(‘#jqxgrid’).html(‘dfd’);
}TrungTran
Hi All,– I study jqwidgets. I using jgrid. But not problem show data.
– Step I call function load jgrid it work. After I call function other load data to $(‘#jqxgrid’).html(‘hello’).
– And after I call function load jgrid again. then it not work.
– Please help.
See code :
-$(document).ready(function () {
data();
});
function data()
{
var theme = getDemoTheme();
var source =
{
datatype: “json”,
datafields: [
{ name: ‘CompanyName’},
{ name: ‘ContactName’},
{ name: ‘ContactTitle’},
{ name: ‘Address’},
{ name: ‘City’}
],
url: ‘grid_data.php’,
cache: true,
async: true
};var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
source: source,
theme: theme,
columns: [
{ text: ‘Company Name’, datafield: ‘CompanyName’, width: 250},
{ text: ‘ContactName’, datafield: ‘ContactName’, width: 150 },
{ text: ‘Contact Title’, datafield: ‘ContactTitle’, width: 180 },
{ text: ‘Address’, datafield: ‘Address’, width: 200 },
{ text: ‘City’, datafield: ‘City’, width: 120 }
]
});}
function datahtml()
{
$(‘#jqxgrid’).html(‘hello’);
}Hello TrungTran,
You should make some modifications to your datahtml function:
function datahtml() { $('#jqxgrid').jqxGrid('destroy'); $("body").append("<div id='jqxgrid'></div>"); $('#jqxgrid').html('hello');}
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.