jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts

  • dujmovicv
    Participant

    Hi Christopher,

    thanks for your reply. After checking the error log on, it seems there’s no MySqli module installed on the other server. I’ll try to install it, as it is less pain than modifying the script for mysql functions instead of mysqli…

    in reply to: Retrieve selected rows Retrieve selected rows #84613

    dujmovicv
    Participant

    Thanks for the guideline, but I’m afraid I need more specific help 🙂
    I have tried this :

    $("#getSelected").on('click', function () {
    	var rowindex = $('#jqxgrid').jqxGrid('getselectedrowindex');
    	var rowindexes = $('#jqxgrid').jqxGrid('getselectedrowindexes');
    	var data = $('#jqxgrid').jqxGrid('getrows', rowindexes);
    	alert(data.company_name + " " + data.RecordID);
    });

    what I get as a response is : undefined undefined
    I’m trying to get the data for ALL the selected rows…
    What I am doing wrong here?

    in reply to: Retrieve selected rows Retrieve selected rows #84606

    dujmovicv
    Participant

    Hi Peter,

    thanks for your reply. Works fine. Is it possible to get instead of those indexes MY id :

    datafields: [
    	{ name: 'RecordID', type: 'number'},
    	{ name: 'company_name', type: 'string'}
    ],
    cache: false,
    id: 'RecordID',

    which is ‘RecordID’ ?


    dujmovicv
    Participant

    I managed to find out the error. It was the
    $result->bind_param('ssi', $_GET['company_name'], $_GET['no_so'], $_GET['RecordID']);
    statement where the parameters number didn’t match with the number of $_GET variables. THANKS for the directions!!!


    dujmovicv
    Participant

    Hi Peter,

    thanks for the quick reply. I was trying to do that but I don’t get any error message from the php file : $res = $result->execute() or trigger_error($result->error, E_USER_ERROR);
    How can I display errors from data.php?

    in reply to: Server side column validation? Server side column validation? #28664

    dujmovicv
    Participant

    I’d appreciate if someone could direct me to the right place in this issue…. Thanks!


    dujmovicv
    Participant

    Thank you Peter! All I had to do is to UPDATE to the newest version… 🙂


    dujmovicv
    Participant

    That’s correct Peter. Here’s my .js.php file :

    <?
    $link = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
    if (!$link) {
    die('Not connected : ' . mysql_error());
    }
    // make foo the current db
    $db_selected = mysql_select_db(DB_NAME, $link);
    if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
    }
    $sel_pers = mysql_query("SELECT id, permission_name FROM user_permissions WHERE permission_name != 'superadmin' ORDER BY id ASC");
    $state_cou = mysql_num_rows($sel_pers);
    $permission_name = "";
    $ri = '1';
    while($state_row = mysql_fetch_array($sel_pers))
    {
    if($ri <= $state_cou)
    {
    $permission_name .= "'".$state_row['permission_name']."', ";
    }
    else
    {
    $permission_name .= "'".$state_row['permission_name']."'";
    }
    $ri++;
    }
    ?>
    <script type="text/javascript">
    $(document).ready(function () {
    // prepare the data
    var data = {};
    var theme = 'classic';
    var source =
    {
    datatype: "json",
    datafields: [
    { name: 'id', type: 'number' },
    { name: 'username', type: 'string' },
    { name: 'full_name', type: 'string' },
    { name: 'userlevel', type: 'string' },
    { name: 'email', type: 'string' },
    { name: 'phone', type: 'string' }
    ],
    id: 'id',
    url: 'grid/jqwidgets/controllers/users_controller.php',
    deleterow: function (rowid, commit) {
    // synchronize with the server - send delete command
    var data = "delete=true&id=" + rowid;
    $.ajax({
    dataType: 'json',
    url: 'grid/jqwidgets/controllers/users_controller.php',
    data: data,
    success: function (data, status, xhr) {
    // delete command is executed.
    commit(true);
    }
    });
    },
    updaterow: function (rowid, rowdata) {
    // synchronize with the server - send update command
    var data = "update=true&" + $.param(rowdata);
    $.ajax({
    dataType: 'json',
    url: 'grid/jqwidgets/controllers/users_controller.php',
    data: data,
    success: function (data, status, xhr) {
    // update command is executed.
    }
    });
    }
    };
    var linkrenderer = function (row, column, value) {
    if (value.indexOf('#') != -1) {
    value = value.substring(0, value.indexOf('#'));
    }
    var format = { target: '"_blank"' };
    var html = $.jqx.dataFormat.formatlink(value, format);
    return html;
    };
    // filter
    var addfilter = function () {
    var filtergroup = new $.jqx.filter();
    var filter_or_operator = 1;
    var filtervalue = '';
    var filtercondition = 'contains';
    var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
    filtervalue = '';
    filtercondition = 'starts_with';
    var filter2 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
    filtergroup.addfilter(filter_or_operator, filter1);
    filtergroup.addfilter(filter_or_operator, filter2);
    // add the filters.
    $("#jqxgrid").jqxGrid('addfilter', 'firstname', filtergroup);
    // apply the filters.
    $("#jqxgrid").jqxGrid('applyfilters');
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    var editrow = -1;
    // initialize jqxGrid
    $("#jqxgrid").jqxGrid(
    {
    source: dataAdapter,
    width: "100%",
    <?
    if ($permisssionToEditUser == 1) { echo "editable: true,"; }
    ?>
    theme: theme,
    pageable: true,
    autoheight: false,
    columnsresize: true,
    filterable: true,
    autoshowfiltericon: true,
    sortable: true,
    columns: [
    //{ text: 'ID', datafield: 'id', editable: false, width: 35 },
    { text: 'Username', datafield: 'username', cellsrenderer: linkrenderer, editable: false },
    { text: 'Full Name', datafield: 'full_name' },
    { text: 'Userlevel', datafield: 'userlevel', columntype: 'dropdownlist',
    createeditor: function (row, cellvalue, editor) {
    var dataSource = [<?=$permission_name;?>];
    editor.jqxDropDownList({source: dataSource });
    }
    },
    { text: 'Email', datafield: 'email' },
    { text: 'Phone', datafield: 'phone' }
    ]
    });
    $("#deleterowbutton").jqxButton({ theme: theme });
    // delete row.
    $("#deleterowbutton").bind('click', function () {
    var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
    var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
    if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
    var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
    var commit = $("#jqxgrid").jqxGrid('deleterow', id);
    }
    });
    // trigger the column resized event.
    $("#jqxgrid").bind('columnresized', function (event) {
    var column = event.args.columntext;
    var newwidth = event.args.newwidth
    var oldwidth = event.args.oldwidth;
    $("#eventlog").html("Column: " + column + ", " + "New Width: " + newwidth + ", Old Width: " + oldwidth);
    });
    });
    </script>

    I’ve tried to set ‘autoheight’ to FALSE but the result was the same : still can’t click the link on a touchscreen platform (iOS, iPad)…
    Any other suggestion? I appreciate your help!!!!!

    in reply to: Custom 'deleterow' function Custom 'deleterow' function #16737

    dujmovicv
    Participant

    I see. So I cannot define a new method ‘delete_forever’ (as mentioned above). Is there a way to pass another variable (do_what) to the method ‘deleterow’ to set the ‘data’ dynamically? I.E. :

    deleterow: function (rowid, commit) {
    // synchronize with the server - send delete command
    switch (do_what) {
    case 'restore':
    var data = "restore_file=true&id=" + rowid;
    break;
    case 'delete_forever':
    var data = "delete_forever=true&id=" + rowid;
    break;
    }
    $.ajax({
    dataType: 'json',
    url: 'grid/jqwidgets/controllers/trash_files_controller.php',
    data: data,
    success: function (data, status, xhr) {
    // delete command is executed.
    commit(true);
    }
    });
    },

    Thank you in advance.
    Best regards.


    dujmovicv
    Participant

    That was that Peter, thank you!!!!


    dujmovicv
    Participant

    Thank you Peter for your reply. I think I’m gonna change some methods that I thought will do the job…


    dujmovicv
    Participant

    I’m sorry guys, my mistake… The error was in the controller php file. Sorry to flood the forum with this otiose post!


    dujmovicv
    Participant

    Heh, that was it!!!! Totally confused me that is WAS working with just true and wasn’t with false… Thanks Peter, you’re the man!


    dujmovicv
    Participant

    I’ve managed to retrieve the $.param(rowdata) values and now I’m even more confused…. The ‘finished’ value is passed correctly : it is ‘true’ when checked and ‘false’ when unchecked.
    I modified my php to :

    if ($_GET['finished'] == true) {
    $update_query_2 = "UPDATE tasks_on_project SET
    finished = '1'
    WHERE project_id = '".$project_id."' AND task_id = '".$task_id."'";
    }
    if ($_GET['finished'] == false) {
    $update_query_2 = "UPDATE tasks_on_project SET
    finished = '0'
    WHERE project_id = '".$project_id."' AND task_id = '".$task_id."'";
    }

    It does NOT work when finished=false
    What am I doing wrong???


    dujmovicv
    Participant

    No, I’m using 2.4.2
    Is there a way to check the value of $.param(rowdata)? Maybe in the browser console?
    Thank you for helping me 🙂

Viewing 15 posts - 1 through 15 (of 19 total)