Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dev-ncw

Pages: [1]
1
Perfect! Just what I needed! Thanks!

2
Hello,

My grid has 7 columns; Monday thru Sunday. These are all checkbox columns that allow user to select one or more columns. I've implemented these checkboxes using render call back function and cellClick event as follows:

Code: [Select]
{
                title: "Mon", dataIndx: "exceptionMon", width: 30, dataType: "boolean", align: "center", type: "checkbox", editable: false,
                render: function (ui) {
                   

                    return "<input type='checkbox' " + (ui.cellData ? "checked='checked'" : "") + "/>";

                }               
                , hidden: false
            }

Code: [Select]
$("#grid_array").pqGrid({
        cellClick: function (evt, ui) {
           
            if (exceptionDays.indexOf(ui.dataIndx) > -1) {
                var exceptionVal = ui.rowData[ui.dataIndx];
               
                if (exceptionVal == undefined || exceptionVal == false) {
                   
                    ui.rowData[ui.dataIndx] = true;

                } else {
                   
                    ui.rowData[ui.dataIndx] = false;
                }
            }

        }
    });

This works fine with only one problem. Because I've used cellClick event, the properties are set to True/False even if the cell is clicked and not the checkbox. Is there a way to set properties to true or false only when the checkbox is clicked?

Please let me know if you need additional information.

Thanks in advance.


3
For those who stumble upon this post looking for answers to similar problem, this is what worked for me (for Pqgrid free V 2.0.4).

Code: [Select]
    $(document).on("blur", ".pq-editor-focus", function (evt) {
        var $grid = $(this).closest(".pq-grid");
        $grid.pqGrid("saveEditCell");
       
    });

As a note, do not have separate code for Cellbeforesave event along with above code as this will result in infinite recursion.

Hope this helps somebody.

Thanks to Paramquery admins for answering a similar question in an older post.

4
Hello,

I have the grid setup and running. It seems though that in order to save newly entered data in the cell the user has to either hit either the "tab" key or the "enter" key. This however is not so intuitive for the last cell. Last cell in my grid is shipping date with date editor. Users simply select a date and hit save resulting in validation error that says that Shipping date is required (attachment shows this situation).

I've tried the following on the shipping date column:

Code: [Select]
editModel: { keyUpDown: false, onBlur: 'save', saveKey: '' }
Code: [Select]
editModel: { keyUpDown: false, saveKey: '' }
Code: [Select]
editModel: { keyUpDown: false, onBlur: 'save'}
Which failed to work and so I tried the following (which didn't work either):

Code: [Select]
    grid.on("pqgridquiteditmode", function (evt, ui) {
        //exclude esc and tab           
        if (evt.keyCode != $.ui.keyCode.ESCAPE && evt.keyCode != $.ui.keyCode.TAB) {
            grid.pqGrid("saveEditCell");
        }
    });

In general is it possible to save data to a cell when it loses focus?

Thanks

5
Thanks! It works.

6
Hello,

I am trying to build a small test application. In my application I am populating the grid with static data (plz see attach). I want to post this data to server. When I try to post the data, I am receiving list of objects on the server but values of all the properties is always null (attachment 2).

Below is my code.

Model
public class GridData
    {
        public string contract { get; set; }
        public string commercialID { get; set; }
        public string commercialTitle { get; set; }
        public int spotLength { get; set; }
        public int rotationPercentage { get; set; }
        public string commercialVia { get; set; }
        public string onHand { get; set; }
        public DateTime shippingDate { get; set; }
    }

Controller Method

 public JsonResult TestGridJSONData(List<GridData> lstGridData)
        {
            Console.Write("Total objects received :: "+lstGridData.Count);
           
            return new JsonResult { Data = "Commercial Tiiitle :: " + lstGridData[0].commercialTitle };
        }

Client Side JS Code
$(function(){

    var data = [ ['98765432','12345678A15E', 'Tried and True', 30, 50, '', 'Y', ''],
            ['98765432','23456789D30E', 'Family paddling', 30, 50, '', 'N', 'Aug 3/16']];
           
    var obj = {};
    obj.width = 770;
    obj.height = 350;
    obj.showTop = true;
    obj.showBottom = true;
    obj.collapsible = true;
    obj.showHeader = true;
    obj.roundCorners = true;
    obj.rowBorders = true;
    obj.columnBorders = true;
    obj.flexHeight = true;
    obj.numberCell = { show: false };
    obj.pageModel = { type: "local" };    obj.title = "Codesheet Grid";

    obj.stripeRows = true;

    obj.colModel = [{title:"Contract", width:80, dataType:"string"},
        {title:"Commercial ID", width:120, dataType:"string"},
        {title:"Commercial Title", width:150, dataType:"string"},
        {title:"Spot Length", width:60, dataType:"integer"},
        {title:"Rotation %", width:60, dataType:"integer"},
        {title:"Commercial Via", width:135, dataType:"string"},
        {title:"On Hand? (Y / N)", width:70, dataType:"string"},
        {title:"Shipping Date", width:160, dataType:"date"}];

    obj.dataModel = {data:data};

    $("#grid_array").pqGrid( obj );
                               
    $( "#accordion" ).accordion({ heightStyle: "content" });

    $('.datepick').each(function(){ $(this).datepick(); });
    $('.daterangepick').each(function(){ $(this).datepick({ rangeSelect: true, monthsToShow: 2, showTrigger: '#calImg'}); });
   
   
});


$("#Save").click(function () {

    var s = $("#grid_array").pqGrid("option", "dataModel.data");
   
    var data = JSON.stringify(s);

   
    $.ajax({
        url: "/CodeSheet/TestGridJSONData",
        contentType: "application/json; charset=utf-8",
        type: "POST",
        data: data,

        success: function (result) {
            alert(result);
        }

    });



});

Can you please let me know what am I missing here?

Thanks,

Pages: [1]