jQWidgets Forums

jQuery UI Widgets Forums Grid add a button to grid

This topic contains 3 replies, has 3 voices, and was last updated by  shawn 9 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • add a button to grid #73420

    shawn
    Participant

    I am creating a grid from json data.
    I want to add a column to each row with a button in it.
    I can create the button, but there is no text in it and I don’t know how to add a function to the button.

    this is my code:

    	 	 var cgiString="../cgi/t3query.exe?"+dataString
    
    			var data =
    			{
    			    datatype: "json",
    			    datafields: [
    			        { name: 'category'},
    			        { name: 'custID'},
    			        { name: 'assignedTo'},
    			        { name: 'openDate'},
    			        { name: 'qStatus'},
    			        { name: 'problem'},
    			        { name: 'tNumber'},
    			    ],
    			    id: 'id',
    			    url: cgiString
    			};			 				
    			
        	$("#qResults").jqxGrid({ width: '835px', height: '300px',theme:'darkblue'});
        	
    			$("#qResults").jqxGrid(
    			{
    			    source: data,
    			    theme: 'darkblue',
    			    columns: [
    			        { text: 'ticket#', datafield: 'tNumber', width: 60},
    			        { text: 'customer ID', datafield: 'custID', width: 100 },
    			        { text: 'problem', datafield: 'problem', width: 250 },
    			        { text: 'assigned', datafield: 'assignedTo', width: 80 },
    			        { text: 'date', datafield: 'openDate', width: 100 },
    			        { text: 'status', datafield: 'qStatus', width: 55 },
    			        { text: 'category', datafield: 'category', width: 100 },
    			        { text: 'action', 
    			        				columntype: 'button', 
    			        				type: 'bool',
    			        				cellsrenderer:  function (row,column,value){
    			        						//do something on click
    			        				}}
    			    ]
    			}); 		

    My grid looks like this:
    what the grid looks like

    when the user clicks the button, I need to get the value of that row’s “ticket” column cell to pass to a function

    add a button to grid #73433

    Peter Stoev
    Keymaster

    Hi shawn,

    It’s demonstrated here – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/popupediting.htm?arctic

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    add a button to grid #73434

    ivailo
    Participant

    Hi shawn,

    You can use buttonclick: function (row).
    Look at this demo for example.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    add a button to grid #73470

    shawn
    Participant

    thank you

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

You must be logged in to reply to this topic.