This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Innovator 11.0 JavaScript API Reference- GridContainer Methods not have AddColumn() method so how to add column to grid ???

rrt - Thursday, June 30, 2016 6:15 AM:

hi...

i generate  gird on form . In this grid i am able to add row to grid as Innovator 11.0 JavaScript API Reference-GridContainer Methods  has addRow() method but i am not able to add column to grid as Innovator 11.0 JavaScript API Reference- GridContainer Methods  has no addcolumn() method

but for Innovator 9.1 Client API Reference -GridContainer Methods  has AddColumn() method which not able to use in latest aras version .

so what is another method  for AddColumn()  in Innovator 11.0 JavaScript API Reference- GridContainer Methods

thank in advance



edonahue - Thursday, July 7, 2016 7:30 PM:

Hi R,

What is your use case for adding columns to your grid? Are you trying to add columns dynamically?



rrt - Friday, July 8, 2016 1:35 AM:

yes i want to add column dynamically to existing grid .



edonahue - Friday, July 8, 2016 9:52 AM:

Hi R,

I'm not seeing a built-in function for dynamically adding a column to an existing grid. I recommend writing a custom function that adds a column to the grid definition and refreshes the grid.



rrt - Friday, July 8, 2016 12:12 PM:

You have any idea about function to add column to grid  dynamically 



edonahue - Monday, July 11, 2016 11:05 AM:

Hi R,

Can you provide the code you have so far for initializing your grid in the HTML field? 



rrt - Tuesday, July 12, 2016 2:11 AM:

var gridControl = null;
var gridXML = '' +
'<table class="myTable">' +
getHeaderForPackRecon() +
abc() +
'</table>';

window.addEventListener("DOMContentLoaded", function () {
clientControlsFactory.createControl("Aras.Client.Controls.Public.GridContainer", {id: "grid", connectId: "gridTD"}, function(control)
{
gridControl = grid = control;
clientControlsFactory.on(grid, {
"gridClick": onClick,
"gridSelectCell": onSelectCell,
"gridKeyPress": onKeyPressed,
"gridEditCell": OnEditCell,
"gridMenuClick": onMenuClick,
"gridMenuInit": InitMenu,
"gridDoubleClick": onDoubleClick
});
gridControl.Delimeter="|";
gridControl.InitXML(gridXML);

});
});

above code is for intializing grid



edonahue - Friday, July 15, 2016 2:33 PM:

Hi R,

Based on your code above, your custom addRow() function will need to modify the contents gridXML to add a row to the table and header. 



rrt - Saturday, July 16, 2016 12:44 AM:

hii Eli , but  addRow() fuction work correctly it add row to table , i have to add column but i am not able to add for that i need some referance code to add column dynamically to existing grid

i am able to get xml of existing grid using getXML() but how to modify it to add column to it



edonahue - Monday, July 18, 2016 10:34 AM:

Hi R,

Pardon my typo - I meant that your addColumn() function will need to update the gridXML. Basically, what you will need to do is append the new column header to the output of getHeaderForPackRecon() and append the new column body to the output of abc(). You may also need to update the query that retrieves the contents of your grid to get the data for your new column. Lastly, re-initialize your grid with the new gridXML. The grid should repaint with the new column.



rrt - Tuesday, July 19, 2016 5:42 AM:

hi Eli Donahue,

thank for your reply

it works