Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - benni

Pages: [1]
1
Help for ParamQuery Grid (free version) / Re: Switch tables from database
« on: February 18, 2014, 05:50:07 pm »
Thank you very much, works like a beuty :)
 ;)

2
Help for ParamQuery Grid (free version) / Re: Wrong data displayd
« on: February 14, 2014, 06:15:25 pm »
UPDATE: Made it work, but not sexy, any clever guys who knows a solution? If I placed some of the code into an other click event things works, but I would be sad to have to use an extra button just for this ;=)

Se below, and more below for orig post.

Code: [Select]
$("#databases").dblclick(function() {

var input = $("#databases").val();;
if(input != db)
db =  $("#databases").val();
else {
   alert('returned');
   return;  }
alert(db);
dbstring = 'fieldmappings.php?dbname=' + db;
//alert(dbstring);
    $('#fortune').load(dbstring);
});

$("#btnCheck1").click(function() {
tbl = $("#fortune");
var obj = $.paramquery.tableToArray(tbl);
    var newobj = {dataModel: {data:obj.data}, colModel: obj.colModel};
    if($("#grid_table").hasClass("pq-grid")){
        $("#grid_table").pqGrid("destroy");
    }
    $("#grid_table").pqGrid(newobj);
});

Thank you, i'll tried and took a look.
The difference on the example and mine is that the old table is supposed to be replaced by a new, but I'll try.
I'v posted the full, updated, code again. Yours work the same way, the table i view is updated, but the grid is still showing the old data - always one 'refresh' behind.
Will it help to change the name of the table each time you think ?

Code: [Select]
<script>
var dbstring = 'fieldmappings.php?dbname=' + db;
//alert(dbstring);
    $('#fortune').load(dbstring);


tbl = $("#fortune");
var obj = $.paramquery.tableToArray(tbl);
    var newobj = {dataModel: {data:obj.data}, colModel: obj.colModel};
    if($("#grid_table").hasClass("pq-grid")){
        $("#grid_table").pqGrid("destroy");
    }
    $("#grid_table").pqGrid(newobj);

</script>

3
Help for ParamQuery Grid (free version) / Switch tables from database
« on: February 14, 2014, 04:45:12 pm »
Hi,
I'm new so maybe I'm doing something terrible wrong :=)
But the problem is that the grid shows the data from the previusly loaded data.
Flow: Selects a database, fetches data from that db's table. Generate html table. The table shows the right data, but the converted grid is wrong.
Please se code below.  The load fetches a generated table.

Code: [Select]
$("#databases").dblclick(function() {
var input = $("#databases").val();;
if(input != db)
db =  $("#databases").val();
else
   return;
   
var dbstring = 'fieldmappings.php?dbname=' + db;
    $('#fortune').load(dbstring);

tbl = $("#fortune");
        obj = $.paramquery.tableToArray(tbl);
if(newObj == null)
{
newObj = { width: 1000, height: 800, title: "ONREGFieldMappings " + db, resizable: true };
        newObj.dataModel = { data: obj.data, rPP: 50, paging: "local" };
        newObj.colModel = obj.colModel;
        $("#grid_table").pqGrid(newObj);
$("#grid_table").pqGrid("option", "scrollModel", { horizontal: $(this).is(":checked") });
}
else {

$("#grid_table").pqGrid( "destroy" );
newObj = { width: 1000, height: 800, title: "ONREGFieldMappings " + db, resizable: true };
        newObj.dataModel = { data: obj.data, rPP: 50, paging: "local" };
        newObj.colModel = obj.colModel;
        $("#grid_table").pqGrid(newObj);
$("#grid_table").pqGrid("option", "scrollModel", { horizontal: $(this).is(":checked") });
}

Pages: [1]