jQWidgets Forums

jQuery UI Widgets Forums General Discussions About Rows of Editable Grid

This topic contains 2 replies, has 2 voices, and was last updated by  boo 11 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • About Rows of Editable Grid #44664

    boo
    Participant

    Hi,

    I have a question about jqxGrid. I am using an editable jqxGrid to show my db record rows in grid. It is like in following link:

    grid

    first column is not editable, second column is dropdownlist, third one is text and last one is button. Below two data rows are filtered with date (today) from jqxCalendar. There are a lot of records in db. My question is about filtering. My dropdownlist has almost 8 or 9 different values in db but when i filtered my record rows by date like this sample, the dropdownlist element size is 2, only Genel and PAROS, no others. I couldn’t select another list elements from dropdownlist when i need to update the row. I have to select all element of dropdownlist although i use filtering. How can i make it? Then, i want to add a text area or html tags inside third(text) column of grid. Is it possible?

    Regards,

    Orcun.

    About Rows of Editable Grid #44800

    Dimitar
    Participant

    Hello Orcun,

    We tested for the reported issue with the following example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.10.2.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/jqxlistbox.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.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.filter.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
        <script type="text/javascript" src="../../scripts/gettheme.js"></script>
        <script type="text/javascript" src="generatedata.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var theme = "";
    
                var data = generatedata(500);
                var source =
                {
                    localdata: data,
                    datafields:
                    [
                        { name: 'firstname', type: 'string' },
                        { name: 'lastname', type: 'string' },
                        { name: 'productname', type: 'string' },
                        { name: 'date', type: 'date' },
                        { name: 'quantity', type: 'number' },
                        { name: 'price', type: 'number' }
                    ],
                    datatype: "array"
                };
    
                var addfilter = function () {
                    var filtergroup = new $.jqx.filter();
    
                    var filter_or_operator = 1;
                    var filtervalue = 'Beate';
                    var filtercondition = 'contains';
                    var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
    
                    filtervalue = 'Andrew';
                    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 adapter = new $.jqx.dataAdapter(source);
    
                $("#jqxgrid").jqxGrid(
                {
                    width: 670,
                    source: adapter,
                    theme: theme,
                    filterable: true,
                    sortable: true,
                    editable: true,
                    ready: function () {
                        addfilter();
                    },
                    autoshowfiltericon: true,
                    columns: [
                      { text: 'First Name', datafield: 'firstname', width: 90, columntype: 'dropdownlist' },
                      { text: 'Last Name', datafield: 'lastname', width: 90 },
                      { text: 'Product', datafield: 'productname', width: 170 },
                      { text: 'Order Date', datafield: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' },
                      { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
                      { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }
                    ]
                });
    
                $('#events').jqxPanel({ width: 300, height: 80, theme: theme });
    
                $("#jqxgrid").on("filter", function (event) {
                    $("#events").jqxPanel('clearcontent');
                    var filterinfo = $("#jqxgrid").jqxGrid('getfilterinformation');
    
                    var eventData = "Triggered 'filter' event";
                    for (i = 0; i < filterinfo.length; i++) {
                        var eventData = "Filter Column: " + filterinfo[i].filtercolumntext;
                        $('#events').jqxPanel('prepend', '<div style="margin-top: 5px;">' + eventData + '</div>');
                    }
                });
    
                $('#clearfilteringbutton').jqxButton({ height: 25, theme: theme });
                $('#filterbackground').jqxCheckBox({ checked: true, height: 25, theme: theme });
                $('#filtericons').jqxCheckBox({ checked: false, height: 25, theme: theme });
                // clear the filtering.
                $('#clearfilteringbutton').click(function () {
                    $("#jqxgrid").jqxGrid('clearfilters');
                });
                // show/hide filter background
                $('#filterbackground').on('change', function (event) {
                    $("#jqxgrid").jqxGrid({ showfiltercolumnbackground: event.args.checked });
                });
                // show/hide filter icons
                $('#filtericons').on('change', function (event) {
                    $("#jqxgrid").jqxGrid({ autoshowfiltericon: !event.args.checked });
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
            <div id="jqxgrid">
            </div>
            <div id="eventslog" style="margin-top: 30px;">
                <div style="width: 200px; float: left; margin-right: 10px;">
                    <input value="Remove Filter" id="clearfilteringbutton" type="button" />
                    <div style="margin-top: 10px;" id='filterbackground'>
                        Filter Background</div>
                    <div style="margin-top: 10px;" id='filtericons'>
                        Show All Filter Icons</div>
                </div>
                <div style="float: left;">
                    Event Log:
                    <div style="border: none;" id="events">
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>

    Even if the grid is filtered, all the available values are displayed in the dropdownlist editor of the first column.

    As for HTML tags in a cell, please check out the last example in the forum topic JSON and newline char for a solution.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    About Rows of Editable Grid #44844

    boo
    Participant

    thank you so much Dimitar, i will try it.

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

You must be logged in to reply to this topic.