Hi all, is it possible to set columns width in the AttributeTable widget?
Thanks,
Naty
Naty,
Remove that line that was left over from some other code trials.
Hi Naty,
I know it has been a long time since you wrote in this thread, but could you tell me where you put the get _activeTable code? I tried putting it in the _FeatureTable.js and also the Widget,js files, but neither seemed to work.
I can get _activeTable from this code:
var _activeTable=attWidget._tableFunctionController.getActiveTable();
then I can resize my column.
but the last row...(this._fitColumns(_activeTable.grid);) doesn't work.
Robert, that's the screenshot of Google Developer Tools.
That means that the code did not find the Attribute Table widget then. Do you have the AT Widget loaded in your app?
Hi Robert, I tried with your code but I get an error:Cannot read property 'grid' of undefined and
In console, if I try to run attWidget._activeTable, I get undefined.
It is possible with a great deal of effort forethought on how you will handle this for each layer, etc.
It would be up to you to figure out where you would put this code and how you will determine the width of your fields.
First you would have to get a refference to the AT Widget.
var widgetCfg = this._getWidgetConfig('AttributeTable');
if(widgetCfg){
var attWidget = WidgetManager.getInstance().getWidgetByLabel(widgetCfg.label);
//AT Widget fields have an id of "field0", "field1", etc the first value in the
//resizeColumnWidth function is the column Id and then the width in pixels
attWidget._activeTable.grid.resizeColumnWidth("field1", 200);
this._fitColumns(attWidget._activeTable.grid);
}
Support function:
_getWidgetConfig: function(widgetName){
var widgetCnfg = null;
array.some(WidgetManager.getInstance().appConfig.widgetPool.widgets, function(aWidget) {
if(aWidget.name == widgetName) {
widgetCnfg = aWidget;
return true;
return false;
});
if(!widgetCnfg){
/*Check OnScreen widgets if not found in widgetPool*/
array.some(WidgetManager.getInstance().appConfig.widgetOnScreen.widgets, function(aWidget) {
return widgetCnfg;
},
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.