jQWidgets Forums

jQuery UI Widgets Forums Grid Checkbox Editor in PHP and Virtual Mode

This topic contains 6 replies, has 4 voices, and was last updated by  Peter Stoev 11 years ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • muithi
    Member

    I am having a problem whereby i cannot select more than 2 checkboxes in my grid and when i click on checkboxes in the 4th page in the grid,the checkboxes disappear.Please someone assist me.I am using PHP and MSSQL 2008 on server side.

    <?php
    #Include the connect.php file
    include('connect.php');
    #Connect to the database
    //connection String
    $connect = mssql_connect($hostname, $username, $password, $database)
    or die('Could not connect: ');
    //Select The database
    #$bool = mysql_select_db($database, $connect);
    $bool = mssql_select_db($database,$connect) or die(mssql_error());
    if ($bool === False){
    print "can't find $database".mssql_error();
    }
    // get data and store in a json array

    if ((!isset($_GET['pagenum'])) || (!is_numeric($_GET['pagenum'])) || ($_GET['pagenum'] < 1)) {
    $pagenum = 1;
    }
    else {
    $pagenum = $_GET['pagenum'];
    }

    $pagenum = $_GET['pagenum'];
    $pagesize = $_GET['pagesize'];
    $start = $pagenum * $pagesize;
    //echo "JOSEPH VALUE OF START IS ".$start;
    //$top = $start - $pagesize;
    //$end = $top + 1;
    //$query = "SELECT SQL_CALC_FOUND_ROWS * FROM file_claiming ORDER BY File_Name ASC LIMIT $start, $pagesize";
    //$query = "SELECT * FROM ( SELECT id, File_Name, Scheme_Name, ROW_NUMBER() OVER (ORDER BY File_Name ASC) as row  FROM ret.dbo.Benefit_source) a WHERE a.row BETWEEN $end AND $start";
    $query = "SELECT TOP $pagesize id as Refute,File_Name,Scheme_Name,id FROM ret.dbo.Benefit_source2 WHERE locked_state=0 AND File_Name NOT IN (SELECT TOP $start File_Name FROM ret.dbo.Benefit_source2 WHERE locked_state = 0 ORDER BY File_Name asc) ORDER BY File_Name ASC";

    //$query = "SELECT TOP 20 File_Name,Scheme_Name,id FROM ret.dbo.Benefit_source WHERE locked_state=0 AND File_Name NOT IN (SELECT TOP 40 File_Name FROM ret.dbo.Benefit_source WHERE locked_state = 0 ORDER BY File_Name asc) ORDER BY File_Name ASC";

    $result = mssql_query($query,$connect) or die("SQL Error 1: ".mssql_error()."\n");
    //$sql = "SELECT COUNT(*) AS found_rows FROM ret.dbo.Benefit_source";
    $sql = "SELECT COUNT(*) AS found_rows FROM ret.dbo.Benefit_source2 WHERE locked_state = 0";
    //$rows = mssql_query($sql, $connect) or die(mssql_error());
    $rows = mssql_query($sql,$connect) or die(mssql_error());
    $rows = mssql_fetch_assoc($rows);
    //$rows = mssql_num_rows($rows);
    //$rows = mssql_num_rows($result);
    $total_rows = $rows['found_rows'];
    //echo "JOSEPH VALUE OF [TOTAL ROWS] IS ".$total_rows;

    while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
    $customers[] = array(
    //'ID' => '<input type="checkbox" name="chkID[]" value="'.$row['id'].'">',
    //$row['Refute'] = false;
    'Refute' => $row['Refute'],
    'ID' => $row['id'],
    'File_Name' => $row['File_Name'],
    'Scheme_Name' => $row['Scheme_Name']
    );
    }
    $data[] = array(
    'TotalRows' => $total_rows,
    'Rows' => $customers
    );
    echo json_encode($data);
    ?>

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.classic.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../scripts/gettheme.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    // prepare the data
    var theme = 'classic';

    var source =
    {
    datatype: "json",
    updaterow: function (rowid, rowdata) {
    // synchronize with the server - send update command
    },
    datafields: [
    { name: 'Refute'},
    { name: 'ID'},
    { name: 'File_Name'},
    { name: 'Scheme_Name'}
    ],
    //id: 'ID',
    url: 'data.php',
    root: 'Rows',
    beforeprocessing: function(data)
    {
    source.totalrecords = data[0].TotalRows;
    }
    };

    var dataadapter = new $.jqx.dataAdapter(source);

    // initialize jqxGrid
    // initialize jqxGrid. Disable the built-in selection.
    $("#jqxgrid").jqxGrid(
    {
    width: 800,
    source: dataadapter,
    editable: true,
    selectionmode: 'none',
    theme: theme,
    autoheight: true,
    pageable: true,
    virtualmode: true,
    rendergridrows: function()
    {
    return dataadapter.records;
    },
    columns: [
    { text: '', datafield: 'Refute', columntype: 'checkbox', width: 50 },
    { text: 'ID', datafield: 'ID', editable: false, width: 100 },
    { text: 'Code File Name', editable: false, datafield: 'File_Name',width:200 },
    { text: 'Scheme Name', editable: false, datafield: 'Scheme_Name', width: 450 }
    ]
    });
    //select or unselect rows when the checkbox is clicked.
    $("#jqxgrid").bind('cellendedit', function (event) {
    if(event.args.value) {
    $("#jqxgrid").jqxGrid('selectrow',event.args.rowindex);
    }
    else {
    $("#jqxgrid").jqxGrid('unselectrow',event.args.rowindex);
    }
    });
    //get all selected records.
    $("#Button").click(function () {
    var rows = $("#jqxgrid").jqxGrid('selectedrowindexes');
    var selectedRecords = new Array();
    for (var m = 0; m < rows.length; m++) {
    var row = $("#jqxgrid").jqxGrid('getrowdata', rows[m]);
    selectedRecords[selectedRecords.length] = row;
    }
    });
    });
    </script>
    </head>
    <body class='default'>
    <div id='jqxWidget'">
    <div id="jqxgrid"></div>
    <div style="margin-top: 10px;">
    <input id="Button" type="button" value="Send Code File(s)" />
    </div>
    </div>
    </body>
    </html>


    muithi
    Member

    Peter Stoev
    Keymaster

    Hi muithi,

    Thank you for the feedback!

    The reported issue was successfully reproduced and will be resolved in the next release which is expected in the first week of May. The issue is regarding the CheckBox editor when the Grid’s mode is set to virtual.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    muithi
    Member

    Hi Peter,

    I appreciate your quick response to the above and the fact that this issue will be addressed in the next release.I look forward to implementing the same grid in my application once this is resolved.

    Regards,

    Muithi.


    BrantG
    Member

    I have the same issue when using virtual scrolling and the checkbox controls. After scrolling so far, possibly past the initial 100 records, and then click a checkbox the column disappears. When I click the scroll up/down 1 time the column shows up and the checkbox still shows what was checked.

    I got the May release and the issue is still there. Can anyone confirm if this was fixed or not in the May release?

    Thanks


    kuberasamrat
    Participant

    Peter,

    Version:2.8.0
    DB: mysql

    virtual mode: true

    If we sort one column and then go to next page. If we click check box, all the checkboxes in the checkbox column disappears. Is that fixed in the current release? Please reply ASAP.


    Peter Stoev
    Keymaster

    Hi kuberasamrat,

    Checkbox selection is not supported in ver. 2.8. It is supported since ver. 3.0. The new features and bug fixes are listed on this page: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/releasehistory/releasehistory.htm

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.