Author Topic: cellUnSelect  (Read 2985 times)

Sjaramillo

  • Newbie
  • *
  • Posts: 3
    • View Profile
cellUnSelect
« on: January 09, 2014, 07:21:17 pm »
Hi!

I'm using the Pqgrid and works Perfectly... but I need to call a function when the cellUnSelect event is triggered and I'm getting an error because this event is not calling the required function
Code: [Select]
        var unmodified = datai;

        $(function () {
           

            var obj = { width: 1150, height: 400, title: "Controles de Procesos y Personas", resizable: true, draggable: true };
            obj.colModel = [{ title: "Codigo", width: 100, dataType: "string" },
                            { title: "Nombre", width: 200, dataType: "string" },
                            { title: "Admin", width: 50, dataType: "string" },
                            { title: NombreItems[0], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[1], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[2], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[3], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[4], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[5], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[6], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[1], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[1], width: 60, dataType: "float", align: "center" },
                            { title: NombreItems[1], width: 60, dataType: "float", align: "center" }];

            obj.dataModel = { data: datai };
            $("#grid_array").pqGrid(obj);
            $("#grid_array").pqGrid({ freezeCols: 2 });
            $("#grid_array").pqGrid({
                cellUnSelect: function (event, ui) {
                }
            });

       
        });

        $("#grid_array").on("pqgridcellunselect", function (event, ui) {...}

« Last Edit: January 09, 2014, 08:47:07 pm by Sjaramillo »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: cellUnSelect
« Reply #1 on: January 09, 2014, 10:30:35 pm »
Please read through this documentation on how to use jQueryUI widgets.
http://wiki.jqueryui.com/w/page/12137708/How%20to%20use%20jQuery%20UI%20widgets


This is the right way to listen to cellUnSelect event.

Code: [Select]
$("#grid_array").on("pqgridcellunselect", function (event, ui) {
     alert( 'cellUnSelect' );
}

Another way is to use this callback before initialization of grid, where obj is to be passed to pqGrid constructor and obj should contain the important options e.g. colModel and dataModel.

Code: [Select]
obj.cellUnSelect = function (event, ui) {
     alert( 'cellUnSelect' );
}

I've created an example for you

http://jsfiddle.net/LAgZx/214/
« Last Edit: January 10, 2014, 05:33:06 am by paramquery »