jQuery UI Widgets Forums Grid grid rowselect event

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • grid rowselect event #56580

    mustafa
    Participant

    hi
    if I use This sample code.. event works fine

     function GetPersons()
    {
     
     var data = [{ "Name": "george", "LastName": "brown"}];
    
     var source =
        {
            datatype: "json",
            datafields: [
                { name: 'Name' },
                { name: 'LastName' } 
            ],
            localdata: data
        };
    
        var dataAdapter = new $.jqx.dataAdapter(source);
    
     $("#Person").jqxGrid({
            width: '100%',
            height: 652,
            source: dataAdapter,
            sortable: true,
            theme: 'arctic',
            pagesize: 23,
            pageable: true,
            theme: 'arctic',     
            columns: [
                    
                    { text: 'Name', datafield: 'Name', width: 100 },
                    { text: 'LastName', datafield: 'LastName', width: 100 }
            ],
    
        });
    
     $('#Person').on('rowclick', function (event) {
            var args = event.args;
            var row = args.rowindex;
        });
    }

    but if I use This code.. event not working.. What is the problem?
    thank you

    function GetPersons()
    {
      
    var persons = [];
    
       [HttpPost]
            public JsonResult GetPersons()
            {
                var persons = GetPersonData();
                return Json(new { personData = persons }, JsonRequestBehavior.AllowGet);
            }
     
        $.ajax({
           url: '/School/GetPersons/,
           type: 'POST',
           datatype: "json",
           contentType: "application/json; charset=utf-8",  
           async: false,       
           success : function(result)
           {
              persons = result.personData;  // 150 records returned         
           }
       });
     
      var source =
      {
        datatype: "json",
        dataFields:
            [           
                { name: 'Name', type: 'string' },
                { name: 'LastName', type: 'string' }   
    
            ], 
        localdata:persons 
    }
    
      var dataAdapter = new $.jqx.dataAdapter(source);
     
     $("#Person").jqxGrid({
            width: '100%',
            height: 652,
            source: dataAdapter,
            sortable: true,
            theme: 'arctic',
            pagesize: 23,
            pageable: true,
            theme: 'arctic',     
            columns: [
                    
                    { text: 'Name', datafield: 'Name', width: 100 },
                    { text: 'LastName', datafield: 'LastName', width: 100 }
            ],
    
        });
             
    
    		 $('#Person').on('rowclick', function (event) {
            var args = event.args;
            var row = args.rowindex;
        });
      }
    grid rowselect event #56590

    Peter Stoev
    Keymaster

    Hi mustafa,

    The problem is that the source object is not initialized correctly. dataFields should be changed to datafields. Also please, do not write that something is not working when we have working online demos which demonstrate that this event works.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.