Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sami on May 10, 2009 14:02
open dhtmlx forum
dhtmlxLayout attachGrid() -- grid ID on form submit?

Hi,

I'm attaching a grid into dhtmlXLayout by using:

var grid = layout.cells("a").attachGrid();

In this case ID of the grid sent on HTML POST is randomly generated, for example:

dhxGridObj_FZzAFeHkcngR_ROWID

Is there a way I could define the ID used on HTML POST for a grid created using .attachGrid() ?

Thanks,
Sami
Answer posted by Alex (support) on May 11, 2009 02:13

Hello,

the following property can be used:

var grid =  layout.cells("a").attachGrid();
var id = grid.entBox.id;

Answer posted by Sami on May 11, 2009 04:34

Thanks for your answer,

Is there a way to assign a new ID?  I've tried:

grid.entBox.setAttribute("ID", "myGridID");

and:

grid.endBox.id = "myGridID";

But the original random ID is still used on form HTTP POST.

 

 

Answer posted by Alex (support) on May 11, 2009 05:15

Do you mean the form extension usage ? 

Locally grid.endBox.id = "myGridID" was applied correctly:

var grid = layout.cells("a").attachGrid();
grid.entBox.id = "myGridID";

Please, provide the demo that allows to re-create the issue.

Answer posted by Sami on May 11, 2009 05:51

Yes,  i'm attempting to use the form extension with an ASP .NET form;

I have the layout inside the form tag like this:

<body onload="init_controls();">

<form action="default.aspx">

<div id="step2Layout" style="width:743px;height:644px;"></div>

</form>

</body>

init_controls javascript function is defined inside page <head> -tag:

<script language="javascript">

var step2Layout = new dhtmlXLayoutObject("step2Layout", "3E", "dhx_blue");

gridStg1 = step2Layout.cells("c").attachGrid();

gridStg1.setImagePath("./dhtmlxGrid/codebase/imgs/");

gridStg1.setHeader("&nbsp;,col1,col2,col3,col4");

gridStg1.setInitWidths("20,130,150,200,*")

gridStg1.setColTypes("ch,ro,ro,ro,ro");

gridStg1.setSkin("modern");

gridStg1.attachEvent("onCheck", selected_groups_check);

gridStg1.submitOnlySelected(true);

gridStg1.submitOnlyRowID(true);

gridStg1.init();

gridStg1.entBox.id = "SelectedGroups";

window.alert(gridStg1.entBox.id);

}

</script>

 

 

 

 

Answer posted by Alex (support) on May 11, 2009 06:14

Locally the correct request is sent:

SelectedGroups_selected => selected_row_id

We have attached the same with php server-side.

Attachments (1)
Answer posted by Sami on May 12, 2009 05:53

Thanks for your quick reply, got it working now after setting the container ID using entBox.id,

after that I've just got mixed the correct request data to data from other grids (with random ids) in the same page.

Thanks!