Cols from DB

QuestionsCols from DB
Adrian asked 7 years ago

Hi! I need to put the grid dynamic. I need to show diferents tables in the grid. So i need to change the cols in the grid. I try to do this but doesnt work. Someone can help me ?

I change the query with a <select> in html. The Query works well. But the cols doesnt change.

$( "select" ).change(function() {
var str = "";
$( "select option:selected" ).each(function() {
str += $( this ).val() + " ";
type: "POST",
url: "includes/query.php",
data: { namequery: str[0] }
,success:function (data)
if (data=='OK')
var myGrid = jQuery("#list1");
// reset filters and sort field
postData: {
filters: JSON.stringify({
groupOp: "AND",
rules: []
sortname: ''

// empty toolbar fields
jQuery(".ui-search-input input").val("");



I do a query in Ajax to take the cols and the new query and then I try to change them in the grid. I put these variables in $_SESSION and then call $g->select_command =$_SESSION['query']; and update cols using foreach

Thanks for all! Sorry for my bad english

5 Answers
Abu Ghufran answered 7 years ago


To have difference columns structure, you need to refresh whole page.
The ajax call cannot change the html generated for columns.

adrian answered 7 years ago

You serious? What kind of garbage is it!!?

Abu Ghufran answered 7 years ago

The grid is loaded with 2 server requests.

1) load the columns of grid and related html
2) do an ajax call, to load data of grid.

Only #2 is ajax call, so if you want to change structure you will need page refresh. It will not work with just ajax call and changing sql.
It is how it currently works.

If it is not suitable for your requirement, we recommend to use some alternate grid.

adrian answered 7 years ago


"You serious? What kind of garbage is it!!?" -This post wasn´t me

I try with the reload of page. In Chrome and Opera Works well. But in Mozilla and IE doesn´t work. Any idea?? Thanks so much!!

Abu Ghufran answered 7 years ago

Can you check debug console (F12) for possible JS errors?

Your Answer

17 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?