jQWidgets Forums

jQuery UI Widgets Forums Search Search Results for 'filter'

Viewing 15 results - 661 through 675 (of 8,001 total)
  • Author
    Search Results
  • #105546

    samwassouf
    Participant

    <jqx-grid id=”grid” width=”100%” columns-height=”50″ rows-height=”60″ alt-rows=”true” sortable=”true” pageable=”true” auto-height=”true” row-details=”true” row-details-template=”{{currentSprint.template}}” init-row-details=”currentSprint.initRowDetails()” source-id=”TFSId” columns-resize=”true” filterable=”true” source=”Model.WorkItems”>
    <jqx-grid-columns>
    <jqx-grid-column datafield=”TFSId” text=”TFS ID” width=”5%”>></jqx-grid-column>
    <jqx-grid-column datafield=”EVId” text=”EV ID” width=”5%”></jqx-grid-column>
    <jqx-grid-column datafield=”Type” text=”Type” width=”5%”></jqx-grid-column>
    <jqx-grid-column datafield=”Title” text=”Title” width=”30%”></jqx-grid-column>
    <jqx-grid-column datafield=”TFSStatus” text=”TFS Status” width=”10%”></jqx-grid-column>
    <jqx-grid-column datafield=”EVStatus” text=”EV Status” width=”10%”></jqx-grid-column>
    <jqx-grid-column datafield=”IterationPath” text=”Iteration Path” width=”10%”></jqx-grid-column>
    <jqx-grid-column datafield=”ReleaseNumber” text=”Release” width=”5%”></jqx-grid-column>
    <jqx-grid-column datafield=”AssignedTo” text=”AssignedTo” width=”10%”></jqx-grid-column>
    <jqx-grid-column datafield=”PullRequests” text=”PUll Requests” width=”10%”></jqx-grid-column>
    </jqx-grid-columns>
    </jqx-grid>
    The Title text in the list has string like “ACLD – this is complete [Dev Complete, Ready for Release]”

    I am getting error
    Uncaught SyntaxError: Unexpected identifier
    when I remove [ and ] from the title it works fine.
    any help would be appreciated

    #105545

    Hi,

    I have a grid who is loaded via JSON. I have implemented paging which is working fine.But when i implemented sorting, its not working locally and remote both.

    I wanted to apply remote sorting to it which is not reflecting.Even when i try to sort on client side it doesnt work.I tried by applying to one column for eg-name ,its not getting sorted.And when i remove
    sortcolumn: ‘name’,
    sortdirection: ‘asc’,

    my data doesn’t appear in grid.

    For backend i am using spring mvc and hibernate,mysql to integrate.

    Please let me know where i am missing.

    Please find my code for fileUpload.jsp-

    <%@ page language=”java” contentType=”text/html; charset=ISO-8859-1″
    pageEncoding=”ISO-8859-1″%>
    <%@ taglib prefix = “c” uri = “http://java.sun.com/jsp/jstl/core” %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=”ISO-8859-1″>
    <title>Titanic Passengers Detail</title>
    <link rel=”stylesheet” href=”<c:url value=”/resources/css/jqx.base.css”/>”>
    <script src=”<c:url value=”/resources/js/jquery-1.11.1.min.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxcore.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxdata.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxbuttons.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxscrollbar.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxmenu.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.selection.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxlistbox.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxdropdownlist.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.columnsresize.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.filter.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.filter.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.sort.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.pager.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.grouping.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.columnsreorder.js”/>”></script>
    <script src=”<c:url value=”/resources/js/jqxgrid.edit.js”/>”></script>

    </head>
    <body>
    <h1> File Upload </h1>

    <form id=”uploadFile” method=”post” onsubmit=”return false;” enctype=”multipart/form-data” >
    <input type=”file” name=”csvfile” id=”csvfile” required><br/>
    <button value=”Submit” onclick=”onUploadClick()”>Upload</button>
    </form>
    <br/>
    <br/>

    <div class=”form-search”>
    <form id=”searchForm” method=”post” onsubmit=”return false;” >
    Search By Gender: <input type=”text” name=”searchField” placeholder=”Search” class=”form-control” id=”searchByGender”><br/>
    <button type=”button” id=”searchButton” value=”Submit” onclick=”onSearchByGenderClick()”>Search</button>
    </form>
    </div>

    <br/>
    <br/>

    <div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”>
    <div id=”jqxgrid”></div>
    </div>

    <script type=”text/javascript”>
    myList=””;
    function onUploadClick() {
    var data = new FormData();
    data.append(“file”, csvfile.files[0]);
    console.log(‘data’,data.values.length);

    $.ajax({
    url:’uploadFile’,
    data: data,
    cache: false,
    contentType: false,
    processData: false,
    type:’POST’,
    success: function(response){
    if(response.status == “200”){
    alert(response.filename+” “+response.message);

    }else{
    alert(‘File Not Uploaded.Please try again’);
    }

    }
    });
    }

    function onSearchByGenderClick() {
    var genderValue=$(“#searchByGender”).val();
    if(genderValue.length==0)
    {
    alert(‘Please enter Gender value’);
    }
    else{
    $.ajax({
    url : “search”,
    type : “GET”,
    data : {

    “searchByGender” : genderValue
    },
    success : function(data) {
    console.log(data);
    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘passenger_id’,type: ‘int’},
    { name: ‘passenger_class’ , type: ‘string’},
    { name: ‘name’, type: ‘string’ },
    { name: ‘sex’ , type: ‘string’},
    { name: ‘age’, type: ‘string’ },
    { name: ‘sib_sp’ , type: ‘string’},
    { name: ‘parch’, type: ‘string’ },
    { name: ‘ticket’ , type: ‘string’},
    { name: ‘fare’ , type: ‘string’},
    { name: ‘cabin’ , type: ‘string’},
    { name: ’embarked’, type: ‘string’ }

    ],
    cache: false,
    url: ‘getPassengers?searchByGender=’+genderValue,
    sort: function () {
    // update the grid and send a request to the server.
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘sort’);
    },
    root: ‘Rows’,
    sortcolumn: ‘name’,
    sortdirection: ‘asc’,

    beforeprocessing: function (data) {
    if (data != null)
    {
    source.totalrecords = data.TotalRows;
    }
    }

    };
    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadError: function(xhr, status, error)
    {
    alert(error);
    }
    }
    );
    $(“#jqxgrid”).jqxGrid(
    {
    width: 900,
    source: dataAdapter,
    sortable: true,
    autoheight: true,
    pageable: true,
    columnsresize: true,
    virtualmode: true,
    rendergridrows: function (params) {
    return params.data;
    },
    columns: [
    { text: ‘Passenger ID’, datafield: ‘passenger_id’, width: 120 },
    { text: ‘Class’, datafield: ‘passenger_class’, width: 120 },
    { text: ‘Name’, datafield: ‘name’, width: 250 },
    { text: ‘Gender’, datafield: ‘sex’, width: 120,sortable: false },
    { text: ‘Age’, datafield: ‘age’, minwidth: 120 },
    { text: ‘Sib_sp’, datafield: ‘sib_sp’, minwidth: 120 },
    { text: ‘Parch’, datafield: ‘parch’, minwidth: 120 },
    { text: ‘Ticket’, datafield: ‘ticket’, minwidth: 120 },
    { text: ‘Fare’, datafield: ‘fare’, minwidth: 120 },
    { text: ‘Cabin’, datafield: ‘cabin’, minwidth: 120 },
    { text: ‘Embarked’, datafield: ’embarked’, minwidth: 120 }
    ]
    });
    } ,
    error : function() {
    console.log(“There was an error”);
    }

    });
    }
    }

    </script>

    </body>
    </html>

    Please let me know if i am missing any information from my side.

    Looking forward for your reply

    Thanks


    Todor
    Participant

    Hello Novato,

    Please review the code sample below. It logs in the console the nested grid’s all rows data when it is expanded.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title id='Description'>This example shows how to display nested Grid plugins.</title>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
        <script type="text/javascript" src="../../scripts/jquery-1.12.4.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.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/jqxgrid.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var url = "../sampledata/employees.xml";
    
                var source =
                {
                    datafields: [
                        { name: 'FirstName' },
                        { name: 'LastName' },
                        { name: 'Title' },
                        { name: 'Address' },
                        { name: 'City' }
                    ],
                    root: "Employees",
                    record: "Employee",
                    id: 'EmployeeID',
                    datatype: "xml",
                    async: false,
                    url: url
                };
    
                var employeesAdapter = new $.jqx.dataAdapter(source);
    
                var orderdetailsurl = "../sampledata/orderdetails.xml";
    
                var ordersSource =
                {
                    datafields: [
                        { name: 'EmployeeID', type: 'string' },
                        { name: 'ShipName', type: 'string' },
                        { name: 'ShipAddress', type: 'string' },
                        { name: 'ShipCity', type: 'string' },
                        { name: 'ShipCountry', type: 'string' },
                        { name: 'ShippedDate', type: 'date' }
                    ],
                    root: "Orders",
                    record: "Order",
                    datatype: "xml",
                    url: orderdetailsurl,
                    async: false
                };
    
                var ordersDataAdapter = new $.jqx.dataAdapter(ordersSource, { autoBind: true });
                orders = ordersDataAdapter.records;
                var nestedGrids = new Array();
    
                // create nested grid.
                var initrowdetails = function (index, parentElement, gridElement, record) {
                    var id = record.uid.toString();
                    var grid = $($(parentElement).children()[0]);
                    nestedGrids[index] = grid;
                    var filtergroup = new $.jqx.filter();
                    var filter_or_operator = 1;
                    var filtervalue = id;
                    var filtercondition = 'equal';
                    var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
                    // fill the orders depending on the id.
                    var ordersbyid = [];
                    for (var m = 0; m < orders.length; m++) {
                        var result = filter.evaluate(orders[m]["EmployeeID"]);
                        if (result)
                            ordersbyid.push(orders[m]);
                    }
    
                    var orderssource = { datafields: [
                        { name: 'EmployeeID', type: 'string' },
                        { name: 'ShipName', type: 'string' },
                        { name: 'ShipAddress', type: 'string' },
                        { name: 'ShipCity', type: 'string' },
                        { name: 'ShipCountry', type: 'string' },
                        { name: 'ShippedDate', type: 'date' }
                    ],
                        id: 'OrderID',
                        localdata: ordersbyid
                    }
                    var nestedGridAdapter = new $.jqx.dataAdapter(orderssource);
    
                    if (grid != null) {
                        grid.jqxGrid({
                            source: nestedGridAdapter, width: 780, height: 200,
                            columns: [
                              { text: 'Ship Name', datafield: 'ShipName', width: 200 },
                              { text: 'Ship Address', datafield: 'ShipAddress', width: 200 },
                              { text: 'Ship City', datafield: 'ShipCity', width: 150 },
                              { text: 'Ship Country', datafield: 'ShipCountry', width: 150 },
                              { text: 'Shipped Date', datafield: 'ShippedDate', width: 200 }
                           ]
                        });
    				}
                }
    
                var photorenderer = function (row, column, value) {
                    var name = $('#grid').jqxGrid('getrowdata', row).FirstName;
                    var imgurl = '../../images/' + name.toLowerCase() + '.png';
                    var img = '<div style="background: white;"><img style="margin:2px; margin-left: 10px;" width="32" height="32" src="' + imgurl + '"></div>';
                    return img;
                }
    
                var renderer = function (row, column, value) {
                    return '<span style="margin-left: 4px; margin-top: 9px; float: left;">' + value + '</span>';
                }
    
                // creage grid
                $("#grid").jqxGrid(
                {
                    width: getWidth('Grid'),
                    height: 365,
                    source: source,
                    rowdetails: true,
                    rowsheight: 35,
                    sortmode: "many",
                    sortable: true,
    				initrowdetails: initrowdetails,
    				selectionmode: 'singlecell',
                    rowdetailstemplate: { rowdetails: "<div id='grid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true },
                    ready: function () { },
                    columns: [
                          { text: 'Photo', width: 50, cellsrenderer: photorenderer },
                          { text: 'First Name', datafield: 'FirstName', width: 100, cellsrenderer: renderer },
                          { text: 'Last Name', datafield: 'LastName', width: 100, cellsrenderer: renderer },
                          { text: 'Title', datafield: 'Title', width: 180, cellsrenderer: renderer },
                          { text: 'Address', datafield: 'Address', width: 300, cellsrenderer: renderer },
                          { text: 'City', datafield: 'City', width: 170, cellsrenderer: renderer }
                      ]
    				});
    
    			$('#grid').on('rowexpand', function (event) {
    				var args = event.args;
    				var rowBoundIndex = args.rowindex;
    
    				setTimeout(() => {
    					var nestedGridID = nestedGrids[rowBoundIndex][0].id
    					var rows = $('#' + nestedGridID).jqxGrid('getrows');
    					console.log('rows >>', rows);
    				}, 1);
    			});
            });
        </script>
    </head>
    <body class='default'>
        <div id="grid">
        </div>
    </body>
    </html>

    Let us know if you need further assistance.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com


    Novato
    Participant

    Hi, I would like to know how I can get the data of the nested grid after having expanded a row.

    The first time I expand the row it appears as undefined and when I get the row it is where I recover the data.

    I would like to know if there is any method of the jqxGrid to obtain the data of the nested grid when expanding the row?

    This is the code of my main grid I am working with dynamic columns.

    
    function obtener_datos() {
    
        var persona = $("[id*=ddlPersona]").val();
        var Sucursal = "";
     
        if (persona != 0) {
           
            var valores;
            var datafields = new Array();
            var columns = new Array();
            var columnsArray = [];
          
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "frmPersona.aspx/Intervalo",
                contentType: "application/json; charset=utf-8",
                data: '{id_persona:"' + persona + '",Sucursal:"' + Sucursal + '"}',
                async: false,
    
                success: function(data) {
    
                    if (data != '') {
              
                        valores = JSON.parse(valores[0]);
    
                        for (var i in valores[0]) {
                            datafields.push({ name: i, type: 'string' });
                            columns.push({ text: i, datafield: i, filtercondition: 'CONTAINS', align: 'center', minwidth: 100 });
                           
                        }
    
                        for (var j = 1; j < columns.length; j++) {
                            columnsArray.push(columns[j]);
                          
                        }
    
                    }
    
                    var gridSource =
                    {
                        datatype: "json",
                        datafields: datafields,
                        localdata: valores, 
                        async: false
                      
                    };
    
                    var gridDataAdapter = new $.jqx.dataAdapter(gridSource);
                   
    			
                    $("#gvDatos").jqxGrid({
                        source: gridDataAdapter,
                        width: '100%',
                        columnsresize: true,
                        autoheight: false,
                        autorowheight: false,
                        pageable: true,
                        showfilterrow: true,
                        filterable: true,
                        rowdetails: true,
                        initrowdetails: initrowdetails_BI2,
                        rowdetailstemplate: { rowdetails: "<div id='grid' style=' margin: 10px; '></div>", rowdetailsheight: 250, rowdetailshidden: true },
                     
                        handlekeyboardnavigation: function(event) {
                            var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
                            if (key == 13) {
                               
                                return true;
                            }
                            else if (key == 27) {
                             
                                return true;
                            }
                        },
    
                        columns: columnsArray
    
                    });
       
        /*******************  Nested grid data is only displayed when the row collapses  ********************************/
                $('#gvDatos').on('rowcollapse', function(event) {              
                   
                    console.log("Resultado con columnas subgrid fila contraida: ", col_detalle_subgrid);
    
                });
            
    /************** Here I show the data of the grid nested in the console. The first time I expand the row it shows me undefined in the console. *********/
    
                $('#gvDatos').on('rowexpand', function(event) { 
                                  
                    console.log("Result: ", col_detalle_subgrid);
    
                });
                   
                },
    
                error: function(error) {
                    alert(error.responseText);
                    console.log(error.responseText);
                    jsonValue = jQuery.parseJSON(Error.responseText);
                    alert(error.respose.Text);
                    alert("Error");
                }
            });
    
        }
        else {
          
            $('#PopupDatos').modal('show');
        }
    }
    
    
    #105513

    ganesh
    Participant

    Hi Peter
    I don’t want the option in the filter box but I need sorting only on the click of grid header. is this functionality implemented or not?

    Thank you
    Ganesh Mali.


    jlu
    Participant

    I am

    
        columns: any[] =
        [
             { text: 'Action', datafield: 'id', editable: false, filterable: false,
              createwidget: (row: any, column: any, value: string, htmlElement: HTMLElement): void => {
    
                  const vContainer = document.createElement('div');
                  const vId = 'btnLocationView_' + row.bounddata.id;
                  vContainer.id = vId;
                  htmlElement.appendChild(vContainer);
    
                  
                  console.log(htmlElement);     // #1 correctly prints the html element
                  
                  const vOptions = {
                      value: "<i class='ion ion-android-search' title='View Details' aria-hidden='true'></i>" };
                  
                  const vButton = jqwidgets.createInstance('#'+ vId, 'jqxButton', vOptions);
                  
                  console.log("after create...");  // #2 never gets here
    

    In the code above, the first console.log() correctly prints the element, but 2 lines later I got an error about ERROR Error: Invalid Selector #___! Please, check whether the used ID or CSS Class name is correct – if that valid element is not in the DOM yet, how can I avoid the error and create a jqxButton in this column??

    Thanks!


    Todor
    Participant

    Hello dan123,

    The grid doesn’t refresh. If there is only one element after filtration, after the change it disappears and only the blank rows left and the filter text changes also, because there are no items with that name left. You could review this behavior in the following example. There are more than one item for “Berglunds snabbkp” company name.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com


    dan123
    Participant

    Hi Todor,

    One concern, when i tried to add a ‘createeditor’ with a dropdownlist for cell editing on this ‘CompanyName’ column. For some reason, its freezing up the grid itself.

    But i tried this on my server example, which seems to work fine. But whenever on this ‘CompanyName’ column i selected a filter like ‘Alfreds Futterkiste’ and now if i edited one of the rows in the ‘CompanyName’ column with the ‘createeditor’ dropdown say like ‘Antonio Moreno Taquera’. It refreshes the entire grid and clearing the selected filter ‘Alfreds Futterkiste’.

    Here is my jsfiddle:
    http://jsfiddle.net/gb4mvk3s/1/


    Todor
    Participant

    Hello Novato,

    First for all, please, take a note that a sub-grid is initialized when you expand it for a first time. You will not be able to take a nested grid data if it is not first expanded.

    You could review the example code below. When a row is expanded all nested grid rows are logged in the console. I hope this would be helpful.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title id='Description'>This example shows how to display nested Grid plugins.</title>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
        <script type="text/javascript" src="../../scripts/jquery-1.12.4.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.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/jqxgrid.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var url = "../sampledata/employees.xml";
    
                var source =
                {
                    datafields: [
                        { name: 'FirstName' },
                        { name: 'LastName' },
                        { name: 'Title' },
                        { name: 'Address' },
                        { name: 'City' }
                    ],
                    root: "Employees",
                    record: "Employee",
                    id: 'EmployeeID',
                    datatype: "xml",
                    async: false,
                    url: url
                };
    
                var employeesAdapter = new $.jqx.dataAdapter(source);
    
                var orderdetailsurl = "../sampledata/orderdetails.xml";
    
                var ordersSource =
                {
                    datafields: [
                        { name: 'EmployeeID', type: 'string' },
                        { name: 'ShipName', type: 'string' },
                        { name: 'ShipAddress', type: 'string' },
                        { name: 'ShipCity', type: 'string' },
                        { name: 'ShipCountry', type: 'string' },
                        { name: 'ShippedDate', type: 'date' }
                    ],
                    root: "Orders",
                    record: "Order",
                    datatype: "xml",
                    url: orderdetailsurl,
                    async: false
                };
    
                var ordersDataAdapter = new $.jqx.dataAdapter(ordersSource, { autoBind: true });
                orders = ordersDataAdapter.records;
                var nestedGrids = new Array();
    
                // create nested grid.
                var initrowdetails = function (index, parentElement, gridElement, record) {
                    var id = record.uid.toString();
                    var grid = $($(parentElement).children()[0]);
                    nestedGrids[index] = grid;
                    var filtergroup = new $.jqx.filter();
                    var filter_or_operator = 1;
                    var filtervalue = id;
                    var filtercondition = 'equal';
                    var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
                    // fill the orders depending on the id.
                    var ordersbyid = [];
                    for (var m = 0; m < orders.length; m++) {
                        var result = filter.evaluate(orders[m]["EmployeeID"]);
                        if (result)
                            ordersbyid.push(orders[m]);
                    }
    
                    var orderssource = { datafields: [
                        { name: 'EmployeeID', type: 'string' },
                        { name: 'ShipName', type: 'string' },
                        { name: 'ShipAddress', type: 'string' },
                        { name: 'ShipCity', type: 'string' },
                        { name: 'ShipCountry', type: 'string' },
                        { name: 'ShippedDate', type: 'date' }
                    ],
                        id: 'OrderID',
                        localdata: ordersbyid
                    }
                    var nestedGridAdapter = new $.jqx.dataAdapter(orderssource);
    
                    if (grid != null) {
                        grid.jqxGrid({
                            source: nestedGridAdapter, width: 780, height: 200,
                            columns: [
                              { text: 'Ship Name', datafield: 'ShipName', width: 200 },
                              { text: 'Ship Address', datafield: 'ShipAddress', width: 200 },
                              { text: 'Ship City', datafield: 'ShipCity', width: 150 },
                              { text: 'Ship Country', datafield: 'ShipCountry', width: 150 },
                              { text: 'Shipped Date', datafield: 'ShippedDate', width: 200 }
                           ]
                        });
    				}
                }
    
                var photorenderer = function (row, column, value) {
                    var name = $('#grid').jqxGrid('getrowdata', row).FirstName;
                    var imgurl = '../../images/' + name.toLowerCase() + '.png';
                    var img = '<div style="background: white;"><img style="margin:2px; margin-left: 10px;" width="32" height="32" src="' + imgurl + '"></div>';
                    return img;
                }
    
                var renderer = function (row, column, value) {
                    return '<span style="margin-left: 4px; margin-top: 9px; float: left;">' + value + '</span>';
                }
    
                // creage grid
                $("#grid").jqxGrid(
                {
                    width: getWidth('Grid'),
                    height: 365,
                    source: source,
                    rowdetails: true,
                    rowsheight: 35,
                    sortmode: "many",
                    sortable: true,
    				initrowdetails: initrowdetails,
    				selectionmode: 'singlecell',
                    rowdetailstemplate: { rowdetails: "<div id='grid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true },
                    ready: function () { },
                    columns: [
                          { text: 'Photo', width: 50, cellsrenderer: photorenderer },
                          { text: 'First Name', datafield: 'FirstName', width: 100, cellsrenderer: renderer },
                          { text: 'Last Name', datafield: 'LastName', width: 100, cellsrenderer: renderer },
                          { text: 'Title', datafield: 'Title', width: 180, cellsrenderer: renderer },
                          { text: 'Address', datafield: 'Address', width: 300, cellsrenderer: renderer },
                          { text: 'City', datafield: 'City', width: 170, cellsrenderer: renderer }
                      ]
    				});
    
    			$('#grid').on('rowexpand', function (event) {
    				var args = event.args;
    				var rowBoundIndex = args.rowindex;
    
    				setTimeout(() => {
    					var nestedGridID = nestedGrids[rowBoundIndex][0].id
    					var rows = $('#' + nestedGridID).jqxGrid('getrows');
    					console.log('rows >>', rows);
    				}, 1);
    			});
            });
        </script>
    </head>
    <body class='default'>
        <div id="grid">
        </div>
    </body>
    </html>

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com


    dan123
    Participant

    Noticed a issue if there is a work around that would be great.

    When i changed the filter dropdown placeholder set as ‘All’,

    Issue 1: the grid is not showing the filter placeholder when its completely initialized.

    Issue 2: When i click on the filter dropdown, i still see ‘Please Choose:’ as an item instead it should show item ‘All’ and if i select this item it is showing all ‘blank/null’ records only instead of showing all records.

    Here is the jsfiddle:
    http://jsfiddle.net/ofzqdkn3/1/


    Novato
    Participant

    Hi, I have a main grid with a nested grid like in your demo. I am working with dynamic columns and within my main grid I have a button type column called Edit.

    How can I get the data from the nested grid to show them in the textbox of my modal?

    This is my code.

    Thank you very much for your help.

    
    
    function obtener_datos() {
    
        var persona = $("[id*=ddlPersona]").val();
        var Sucursal = "";
     
        if (persona != 0) {
           
            var valores;
            var datafields = new Array();
            var columns = new Array();
            var columnsArray = [];
          
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "frmPersona.aspx/Intervalo",
                contentType: "application/json; charset=utf-8",
                data: '{id_persona:"' + persona + '",Sucursal:"' + Sucursal + '"}',
                async: false,
    
                success: function(data) {
    
                    if (data != '') {
              
                        valores = JSON.parse(valores[0]);
    
                        for (var i in valores[0]) {
                            datafields.push({ name: i, type: 'string' });
                            columns.push({ text: i, datafield: i, filtercondition: 'CONTAINS', align: 'center', minwidth: 100 });
                           
                        }
    
                        for (var j = 1; j < columns.length; j++) {
                            columnsArray.push(columns[j]);
                          
                        }
    
                    }
    
                    var gridSource =
                    {
                        datatype: "json",
                        datafields: datafields,
                        localdata: valores, 
                        async: false,
                        updaterow: function(rowid, rowdata, commit) {},             
                        async: false,
                        success: function(data, status, xhr) {                                                        
                        commit(true);
                        
                        },
                                
                            });
    
                        }
    
                    };
    
                    var gridDataAdapter = new $.jqx.dataAdapter(gridSource);
    
                    var editrow = -1;
    
                    columnsArray.push({ text: 'Edit', datafield: 'Edit', filtercondition: 'CONTAINS', align: 'center', minwidth: 100, columntype: 'button', cellclassname: "color_especial",  
                        cellsrenderer: function() { },
                        buttonclick: function(row) {
    
                     //***************************  <strong> Here I want to get the data from the nested grid </strong>   **********************//                  
    
                           $("#Popup_Update").modal('show');
                        }
                    });
    			
    			
                    $("#gvDatos").jqxGrid({
                        source: gridDataAdapter,
                        width: '100%',
                        columnsresize: true,
                        autoheight: false,
                        autorowheight: false,
                        pageable: true,
                        showfilterrow: true,
                        filterable: true,
                        rowdetails: true,
                        initrowdetails: initrowdetails_BI2,
                        rowdetailstemplate: { rowdetails: "<div id='grid' style=' margin: 10px; '></div>", rowdetailsheight: 250, rowdetailshidden: true },
                     
                        handlekeyboardnavigation: function(event) {
                            var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
                            if (key == 13) {
                               
                                return true;
                            }
                            else if (key == 27) {
                             
                                return true;
                            }
                        },
    
                        columns: columnsArray
    
                    });
    
                   //Button html input type button 
                    $("#buttonUpdate").click(function() {
    
                      $("#Popup_Update").modal('hide');
    
                        }
                    });
    
                },
    
                error: function(error) {
                    alert(error.responseText);
                    console.log(error.responseText);
                    jsonValue = jQuery.parseJSON(Error.responseText);
                    alert(error.respose.Text);
                    alert("Error");
                }
            });
    
        }
        else {
          
            $('#PopupDatos').modal('show');
        }
    }
    
    
    #105431

    Todor
    Participant

    Hello Novato,

    You could add cellbeginedit and cellsrenderer to the other properties below and they should work as well:

    columnsArray.push({ text: 'Aprobar', datafield: 'Aprobar', filtercondition: 'CONTAINS', align: 'center', minwidth: 100, threestatecheckbox: false, columntype: 'checkbox', type: 'bool', cellbeginedit: cellbeginedit, cellsrenderer: cellsrenderer });

    Unfortunately on every checkbox click updaterow callback is triggered.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com


    dan123
    Participant

    Hi Todor,

    One more thing, is there any way to hide the ‘blank/null’ item option from that column filter dropdown?

    #105404

    Novato
    Participant

    Hi Todor how could I do this without using the cellbeginedit and cellsrenderer, because I am using dynamic columns.

    I also want to ask you if it is possible that by clicking on the checkbox this does not update my data.

      In summary I want that by clicking on any checkbox in my checkbox column this disables the edit button so that the data can no longer be updated without updating the data by itself when clicking on the checkbox.

    Thank you.

    Here I put my code.

    
    
    function obtener_datos() {
    
        var persona = $("[id*=ddlPersona]").val();
        var Sucursal = "";
     
        if (persona != 0) {
           
            var valores;
            var datafields = new Array();
            var columns = new Array();
            var columnsArray = [];
          
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "frmPersona.aspx/Intervalo",
                contentType: "application/json; charset=utf-8",
                data: '{id_persona:"' + persona + '",Sucursal:"' + Sucursal + '"}',
                async: false,
    
                success: function(data) {
    
                    if (data != '') {
              
                        valores = JSON.parse(valores[0]);
    
                        for (var i in valores[0]) {
                            datafields.push({ name: i, type: 'string' });
                            columns.push({ text: i, datafield: i, filtercondition: 'CONTAINS', align: 'center', minwidth: 100 });
                           
                        }
    
                        for (var j = 1; j < columns.length; j++) {
                            columnsArray.push(columns[j]);
                          
                        }
    
                    }
    
                    var gridSource =
                    {
    
                        datatype: "json",
                        datafields: datafields,
                        localdata: valores, 
                        async: false,
                        updaterow: function(rowid, rowdata, commit) {
    
                         
                                             var id = $("#gvDatos").jqxGrid('getrowdata', rowid);
                                             var id_fila = id.id_Persona;
    
                            var usuario = "";
                         
    
                            $.ajax({
                                type: "POST",
                                datatype: "json",
                                url: "frmPersona.aspx/Actualiza_Persona_Bono",
                               // contentType: "application/json; charset=utf-8",
                                data: 
                                                          '{id_bonos:"' + id_fila +
                                                          '",Total_porcentaje:"' + $("#txtTotal_BonoPorcentaje").val() +
                                                          '",Total_pesos:"' + $("#txtTotal_BonoPesos").val() +
                                                          '",Total_porcentaje:"' + $("#txtTotal_GarantizadoPorcentaje").val() +
                                                           '"}',
    
                                async: false,
                                success: function(data, status, xhr) {                            
                                 
                                    commit(true);
                                },
                                error: function(error) {
                                    alert(error.responseText);
                                    console.log(error.responseText);
                                    jsonValue = jQuery.parseJSON(Error.responseText);
                                    alert(error.respose.Text);
                                    alert("Error");
                                }
                            });
    
                        }
    
                    };
    
                    var gridDataAdapter = new $.jqx.dataAdapter(gridSource);
    
                    var editrow = -1;
    
                    columnsArray.push({ text: 'Edit', datafield: 'Edit', filtercondition: 'CONTAINS', align: 'center', minwidth: 100, columntype: 'button', cellclassname: "color_especial",  
                        cellsrenderer: function() { },
                        buttonclick: function(row) {
    
                            editrow = row;
                           
                            var dataRecord = $("#gvDatos").jqxGrid('getrowdata', editrow);
    
                            var nombre_col_Total_bono_porcentaje = $("#gvDatos").jqxGrid('getcolumnat', 12).datafield;
                            var nombre_col_Total_bono_pesos = $("#gvDatos").jqxGrid('getcolumnat', 13).datafield;
                            var nombre_col_Total_garantizado_porcentaje = $("#gvDatos").jqxGrid('getcolumnat', 14).datafield;                    
    
                          
                            $("#txtTotal_BonoPorcentaje").val(dataRecord[nombre_col_Total_bono_porcentaje]);
                            $("#txtTotal_BonoPesos").val(dataRecord[nombre_col_Total_bono_pesos]);
                            $("#txtTotal_GarantizadoPorcentaje").val(dataRecord[nombre_col_Total_garantizado_porcentaje]);
                            
    
                         //Popup bootstrap display data in the input text. 
                           $("#Popup_Actualizar").modal('show');
                        }
                    });
    			
    				//******************     Here I put my checkbox type column     *********************************************//
    				 columnsArray.push({ text: 'Aprobar', datafield: 'Aprobar', filtercondition: 'CONTAINS', align: 'center', minwidth: 100, threestatecheckbox: false, columntype: 'checkbox', type: 'bool' });
    
                    $("#gvDatos").jqxGrid({
                        source: gridDataAdapter,
    					editable:true,
                        width: '100%',
                        columnsresize: true,
                        autoheight: false,
                        autorowheight: false,
                        pageable: true,
                        showfilterrow: true,
                        filterable: true,
                        rowdetails: true,
                        initrowdetails: initrowdetails_BI2,
                        rowdetailstemplate: { rowdetails: "<div id='grid' style=' margin: 10px; '></div>", rowdetailsheight: 250, rowdetailshidden: true },
                     
                        handlekeyboardnavigation: function(event) {
                            var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
                            if (key == 13) {
                               
                                return true;
                            }
                            else if (key == 27) {
                             
                                return true;
                            }
                        },
    
                        columns: columnsArray
    
                    });
    
                   //Button html input type button 
                    $("#btnActualizar").click(function() {
    
                        if (editrow >= 0) {
    
                            var row = {
                                                    
                                "Total Bono %": $("#txtTotal_BonoPorcentaje").val(),
                                "Total Bono $": $("#txtTotal_BonoPesos").val(),
                                "Total Garantizado %": $("#txtTotal_GarantizadoPorcentaje").val(),                        
    
                                  };
    
                            var rowID = $('#gvDatos').jqxGrid('getrowid', editrow);
                            var id_bonos_fila = rowID;
                            console.log("Este es id_bonos_fila: ", id_bonos_fila);
    
                            $('#gvDatos').jqxGrid('updaterow', id_bonos_fila, row);
    
                            $("#Popup_Actualizar").modal('hide');
    
                        }
                    });
    
                },
    
                error: function(error) {
                    alert(error.responseText);
                    console.log(error.responseText);
                    jsonValue = jQuery.parseJSON(Error.responseText);
                    alert(error.respose.Text);
                    alert("Error");
                }
            });
    
        }
        else {
          
            $('#PopupDatos').modal('show');
        }
    }
    
    

    dan123
    Participant

    I am trying to achieve this case where on the jqxgrid i added a dropdown filter set as ‘list’ on the CompanyName column.
    On the data there is record that is ‘blank/null’ on the CompanyName column. Now i want to try filtering this ‘CompanyName’ column by selecting the dropdown and click on any items. Now whatever item i select say its ‘Alfreds Futterkiste’ the grid needs to show the selected item and the ‘blank/null’ record.

    So basically the filter dropdown should show the selected item and any ‘blank/null’ records. Please would like a workaround if possible

    here is my jsfiddle:
    http://jsfiddle.net/z6kjtr41/9/

Viewing 15 results - 661 through 675 (of 8,001 total)