1

Hi could anyone help me correctly configure angular ui grid with requirejs.

So far I have the following and I'm able to create grids however I can't get the column resizing module to load along with ui.grid and tired several different approaches.

requirejs.config({
    "baseUrl": "js/lib",
    "paths": {
      "ui.grid": "../ui-grid.min.js"
    },
    "shim": {
        "ui.grid": {
         deps: ['angular']
        }
    }
});

For column resizing the module 'ui.grid.resizeColumns' has to be added

http://ui-grid.info/docs/#/tutorial/204_column_resizing

1 Answer 1

1

Have you tried this config?

I wonder if you need to use camelCase instead.

requirejs.config({
    "baseUrl": "js/lib",
    "paths": {
        "uiGrid": "../ui-grid.min.js",
        "ui.grid.resizeColumns": "../ui-grid.min.js"
    },
    "shim": {
        "uiGrid": {
           deps: ['angular'],
           exports: 'uiGrid',
        },
        "ui.grid.resizeColumns": {
            deps: ['uiGrid'],
            exports: 'ui.grid.resizeColumns'
        }
    }
});
Sign up to request clarification or add additional context in comments.

3 Comments

Nope does n't work. I've corrected the code and removed the 'exports' as ui.grid on it's own does n't work with that either. The error I get with ui.grid.resizeColumns is: Controller 'uiGrid', required by directive 'uiGridresizeColumns' can't be found! The file contains multiple modules which is making it trickier to get it working. Also tried splitting the code into two files.
Can you post your html as well ?
I modified the config so that uiGrid is camelCase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.