jQWidgets Forums

jQuery UI Widgets Forums Grid dynamic columns and datafields

This topic contains 0 replies, has 1 voice, and was last updated by  cezet 12 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
  • dynamic columns and datafields #19777

    cezet
    Member

    Hi, sorry for bad English.

    I have a problem in creating dynamic columns.

    In php code i create query. Here the structure of my table and php code:

    ID_Channel || MeasureDate || Value
    1 2013-01-01 1232
    1 2013-01-02 1322
    1 2013-01-04 6576
    2 2013-01-06 2324
    2 2013-01-15 2345
    2 2013-01-18 8678
    3 2013-01-21 4456
    3 2013-01-23 4546
    3 2013-01-24 8965
    4 2013-01-26 4674
    4 2013-01-27 3455
    4 2013-01-28 3486
    4 2013-01-29 4536

    include ‘db_connect.php’;

    $tablename = $_GET[‘table’];
    $ID_Val=$_GET[‘ID’];
    $ID_Val= explode(“,”, $ID_Val);

    $d_S = $_GET[‘d_s’];
    $d_Po =$_GET[‘d_po’];

    foreach($ID_Val as $ID){

    $tsql = “select * from $tablename where ID_Channel=$ID and (MeasureDate >CONVERT(DATETIME,’$d_S’,102)) and (MeasureDate round($row[‘Value’],2)
    );

    }

    }

    header(‘Content-Type: application/json’);
    echo json_encode($arr);

    Here my jquery code:
    $(“#jqxSubmitButton”).jqxButton({ width: ‘100’, theme: ‘shinyblack’ });

    $(“#jqxSubmitButton”).on(‘click’, function () {
    var items = $(“#listbox”).jqxComboBox(‘getCheckedItems’);
    var colNames = new Array();
    var colModel = new Array();
    var val_ID = new Array();
    var Names = new Array();
    $.each(items, function (index) {
    val_ID.push(this.value);
    colNames.push(this.label);
    });

    for(var i=0;i<=colNames.length-1;i++){
    colModel.push({text:colNames[i],datafield:val_ID[i],width:160});
    Names.push({name:colNames[i]});
    }
    var item = $('#comboboxTables').jqxComboBox('getSelectedItem');

    var tablename = item.value;
    var getDateS= $('#jqxWidget_S').jqxDateTimeInput('getText');
    var getDatePo= $('#jqxWidget_Po').jqxDateTimeInput('getText');

    var theme = getDemoTheme();

    var source =
    {
    datatype: "json",
    datafields:Names,

    url: "select_Data.php?table="+tablename+"&ID="+val_ID+"&d_s="+getDateS+"&d_po="+getDatePo+"",
    cache: false
    };
    var dataAdapter = new $.jqx.dataAdapter(source);

    $("#jqxgrid").jqxGrid(
    {
    source: dataAdapter,
    theme: theme,
    columns:colModel
    });

    });

    After query in my table i see only empty rows. Can you help me. What is wrong.
    Thanks in advance.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.