jQWidgets Forums

Forum Replies Created

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

  • kathys2151
    Participant

    I fixed my typo, so here is what I have:

    $("#jqxgrid").on('cellclick', function(event) {
        var args = event.args;
        var rowBoundIndex = args.rowindex;
        var value = $('#jqxgrid').jqxGrid('getcellvalue', rowBoundIndex, "projectId");
       
        $.ajax({
            dataType: 'json'
            url: 'newGrid.php',
            data: {pn: value},
            success: function(data, status, xhr) {
                 $('#jqxgrid').load('newGrid.php');
                };
                });
       });

    Then in newGrid.php I lay out the html containing a div with id “byProjectGrid”. In newGrid.php I do a Get on “pn”, and use this variable to get specific data from a mysql db. I also load newGrid.js. In this file I have:

    var source =
    { 
       datatype: "json",
       datafields: [ ............. ]
    }........
    
    $("#jqxgrid").jqxGrid ( .............  )

    The new grid itself is displayed (newGrid.php), and when I check the output in Firebug I am getting the correct JSON data returned, but I cannot get it to display in the new grid. Are you able to help me figure out why this data is not appearing? I’m sure I’m missing something simple….


    kathys2151
    Participant

    Makes sense. I’m almost there. I ended up with the code below, but I cannot figure out how to load the new grid (located in newGrid.php):

    $("#jqxgrid").on ('cellclick', function(event) {
        var args = event.args;
        var rowBoundIndex = args.rowindex;
        var value = $('#jqxgrid').jqxGrid('getcellvalue', rowBoundIndex, "projectId");
        $.ajax({
             dataType: 'json'
             url: 'newGrid.php',
             data: (pn:value},
             success: function (data, status, xhr) {
                 $('#byProjectGrid').load('newGrid.php');
    ....... 

    newGrid.php grabs the pn (which is correct as I output that to an error log), does the mysql search and returns the correct data. Except I never move off the first page. I can see in Firebug the newGrid.php page and the JSON data, but can’t get it to load into the new grid.


    kathys2151
    Participant

    I end up getting an error that projectId is not defined, even though I’ve defined it in the grid.

    $("#jqxgrid").jqxGrid ({
        source: dataAdapter,
         .......
        columns:
        [
             [ text: 'Project Id', datafield: 'projectId', width: 20 }, 
        ........
    
    $("#jqxgrid").on ('cellclick', function(event) {
        var args = event.args;
        var value = args.value;
         source.data = { pn: projectId }; 

    I am using this selection from the user to grab data from a mysql database and show another grid. I have a linkrenderer function set up that assembles the url which includes the projectId, but I need to be able to pass the user’s selection to search the db and build the next grid.


    kathys2151
    Participant

    Using your jqxGrid – left the “x” out – sorry. and I think I grabbed google data from the jqGrid plugin by mistake. Again, my apologies. I have a jqxGrid with two tabs. When I click the tab, I want to grab the deviceId from the main grid, and use it to populate the tab with my ping data. Can’t figure out how to pass the value of the current deviceId from the grid to php .


    kathys2151
    Participant

    I just thought of an easier way to say it. What I am trying to do is send the deviceId for the current row to php in the data parameter. What I am doing now is:

    function displayPingData() {
                 var pingDataSource =
                {
                     datatype: "json",              
                     datafields: [
                       { name: 'deviceId', type: 'string', sortable: 'true'},               
                        { name: 'args', type: 'string', sortable: 'true' },
                        { name: 'pingTime', type: 'string', sortable: 'true' },                   
                        { name: 'starttime', type: 'string', sortable: 'true' })                                                                         
                    ],
    				url: 'getPingData.php',	
                   ajaxSelectOptions: {
                         data: {
                            data: function() {
                                 var rowId = $("#pingDataGrid").jqGrid('getGridParam', 'selrow');
                                 var rowData = $("pingDataGrid").jqGrid.getRowData(rowId);
                                 var deviceId = rowData[deviceId'];
                         }
                    }

    But this seems a bit convoluted to me. Is there an easier way to pass the deviceId from the main grid to php to load the ping data (which is a grid in a tab?)


    kathys2151
    Participant

    The grid is for the second tab.

    I have been trying to set the deviceId in the data property with no luck. Shouldn’t the deviceId be passed already as it is defined as one of the data fields? I’ve tried setting up data as deviceId.val() with no luck.

    in reply to: multiple rows for 1 record multiple rows for 1 record #66231

    kathys2151
    Participant

    Thanks for the quick reply Peter. Is there a way for the nested grid option to work? For example, I’d like each record to be displayed like this:

    ` Hostname IP Description MAC Location Room Number
    xxxxx xx.x.x.x descr aa:aa:aa:aa Bldg 1 444

    OS ServicePack Vendor
    Win7 1 HP`

    I like the option you have to show/hide the OS/ServicePack/Vendor option. The problem is, when I load one record, the line with “hostname”, “IP”, etc displays fine, but I get multiple rows of “OS”, “ServicePack”, “vendor” (when there is only one)


    kathys2151
    Participant

    Ok, that’s what I was wondering. Do you have any samples of this? Or am I better off going in a different direction? I get all my data in one mysql select, but don’t want to show 20 columns at once. I liked the way the row details looked, but need to be able to edit all 20 of the columns.
    Thanks for your help.

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