jQWidgets Forums

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Validation message pop-up Validation message pop-up #9093

    mrkozanoglu
    Member

    Well, we debugged the source jqxgrid.edit.js file and created a solution. I think message pops up but the calculated position is not true so we can’t see it. Here is our solution:

    At line 1117:

          _showvalidationpopup : function(o, d, p) {
    var j = this.editcell.editor;
    if (!j) {
    return
    }
    this.validationpopup = null; // we added these two lines
    this.validationpopuparrow = null;
    in reply to: Validation message pop-up Validation message pop-up #9031

    mrkozanoglu
    Member

    I crated a very simple version of the problem, please try this: when the page loads enter a number higher than 100 and see the pop up message then press the button and change the grid data then try entering the number again and you won’t see the pop up.

    <html>
    <head>
    <title>Grid Test</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jqxcore.js"></script>
    <script type="text/javascript" src="jqxdata.js"></script>
    <script type="text/javascript" src="jqxbuttons.js"></script>
    <script type="text/javascript" src="jqxscrollbar.js"></script>
    <script type="text/javascript" src="jqxgrid.js"></script>
    <script type="text/javascript" src="jqxgrid.selection.js"></script>
    <script type="text/javascript" src="jqxgrid.columnsresize.js"></script>
    <script type="text/javascript" src="jqxdropdownlist.js"></script>
    <script type="text/javascript" src="jqxlistbox.js"></script>
    <script type="text/javascript" src="jqxgrid.edit.js"></script>
    <script src="jquery.alerts.js" type="text/javascript"></script>
    <link rel="stylesheet" href="styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href="styles/jqx.energyblue.css" type="text/css" />
    <script type="text/javascript">
    var source;
    var array1 = [[1,2,3,4],[1,2,3,4],[1,2,3,4]];
    var validationFunc = function (cell, value) {
    var result = true;
    try {
    value = parseInt(value);
    } catch (E) {
    result = {result: false, message: "Please enter a number between 0 and 100." };
    }
    if (value < 0 || value > 100) {
    result = {result: false, message: "Please enter a number between 0 and 100."};
    };
    return result;
    };
    $(document).ready(function () {
    source =
    {
    localdata: array1,
    datatype: "array"
    };
    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function (array1) { },
    });
    $("#jqxgrid").jqxGrid(
    {
    width: 360,
    source: dataAdapter,
    editable: true,
    selectionmode : 'singlecell',
    columns: [
    { text: "0", datafield: 0, width: 90, cellsalign: 'right', cellsformat: 'n', hideable: false, validation: validationFunc },
    { text: "1", datafield: 1, width: 90, cellsalign: 'right', cellsformat: 'n', hideable: false, validation: validationFunc },
    { text: "2", datafield: 2, width: 90, cellsalign: 'right', cellsformat: 'n', hideable: true, validation: validationFunc },
    { text: "3", datafield: 3, width: 90, cellsalign: 'right', cellsformat: 'n', hideable: true, validation: validationFunc }, ]
    });
    $("#button").unbind('click').click(function() {
    array1 = [[9,8,7,6],[9,8,7,6],[9,8,7,6]];
    source.localdata = array1;
    $("#jqxgrid").jqxGrid({ source: source });
    });
    });
    </script>
    </head>
    <body>
    <input type="button" class="button" value="Button" id="button" />
    <div id='jqxWidget'>
    <div id="jqxgrid"></div>
    </div>
    </body>
    </html>
    in reply to: Validation message pop-up Validation message pop-up #8983

    mrkozanoglu
    Member

    Hi,

    I have a combo box and the grid’s data completely changes according to the selection of the combo box. When a combo box selection happens I update the grid data with new data as I said before. This way I create the table only once and just update the grid source when necessary. I set the grid’s source property when I create the table at the beginning.

    As I said the validation works same as before. For example I have a maximum number value that can be entered to a cell. When the value is higher than 100 it’s invalid and the grid doesn’t accept it anymore as it should be and prevents editing other cells. But the validation message that I use to warn the user doesn’t pop up anymore.

    Example code is something like this:

    $(“#selectionBox”).change(function() {

    var tableData = ….. // some new data that I get from database;

    source.localdata = tableData; // source is the grid’s source property that points to jqxDataAdapter and it’s a global variable
    $(“#jqxgrid”).jqxGrid({ source: source });

    // after this point table is updated and validation check works fine but message won’t pop up

    }

    Thanks.

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