Select to view content in your preferred language

Set the dojo data grid table size

3684
4
07-16-2013 07:13 AM
GyeyoungChoi
Deactivated User
Hi,

I'm using dojo data grid for my search results.
but it stretched out longer that it should be.
can anyone tell me what how to set the size for the table?
[ATTACH=CONFIG]25969[/ATTACH]

Thank you.
0 Kudos
4 Replies
JonathanUihlein
Esri Regular Contributor
There is not enough information here to help troubleshoot the actual problem so can you replicate the issue in a JSFiddle?

If you are using a standard dojo data grid, have you checked the Dojo API?

Also, have you looked into dgrid? http://dojofoundation.org/packages/dgrid/
0 Kudos
GyeyoungChoi
Deactivated User
I should have post code as well, my bad.

        store = new dojo.data.ItemFileReadStore({ data:data });
  dojo.style(dojo.byId("grid"), "width", "280px");
  dojo.style(dojo.byId("grid"), "height", "150px"); //obviously this was not working
  var grid = dijit.byId('grid');
  grid.setStore(store);
  grid.resize();
        autoWidth: true;
        autoHeight: true;
        map.centerAndZoom(center, zoom);
      }

<div class ="toggle" id="menu_subA">Enter building number, name and abbreviation<br>
<input type="text" id="searchField" size="30" value="" /><button data-dojo-type="dijit.form.Button"  onClick="doFind();" value="Search">Search</button>
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'1', rowSelector:'10px'">
      <thead>
        <tr>
          <th field="Number" width="50">Num</th>
          <th field="Abbrev" width="50">Abbr</th>
          <th field="CampusCode" width="50">Camp</th>
        </tr>
      </thead>
    </table>
  </div>
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Hi Gyeyoung,

Try setting the height of your div to limit the number of rows returned.  Ex:

<div class ="toggle" id="menu_subA" style="height:55px;">Enter building number, name and abbreviation<br>
    <input type="text" id="searchField" size="30" value="" /><button data-dojo-type="dijit.form.Button"  onClick="doFind();" value="Search">Search</button>
    <table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'1', rowSelector:'10px'">
              <thead>
            <tr>
                  <th field="Number" width="50">Num</th>
                  <th field="Abbrev" width="50">Abbr</th>
                  <th field="CampusCode" width="50">Camp</th>
            </tr>
              </thead>
        </table>
</div>
0 Kudos
AdrianMarsden
Honored Contributor
Hi

Is it OK to put a link to a similar issue that I raised a few days ago - http://forums.arcgis.com/threads/88405-Dynamically-created-datagrid-inside-ExpandoPane-sizing-issues - I've had allsorts of issues with a datagrid inside a expandopane.  every time the pane collapses it re-sizes the datgrid away from the definition - sounds very similar to the OPs problem

Cheers

ACM
0 Kudos