1

Using ui-grid in my project, i am getting JSON object from DB like Below

[
    {
        "checkbox1": {
            "fieldName": "checkbox1",
            "fieldValue": "Y"
        },
        "checkbox2": {
            "fieldName": "checkbox3",
            "fieldValue": "Y"
        },
        "checkbox3": {
            "fieldName": "checkbox3",
            "fieldValue": "N"
        }
    }
]

Below object is columnDef

[
    {
        "name": "checkbox1",
        "field": "checkbox1.fieldValue",
        "displayName": "checkbox1",
        "cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
    },
    {
        "name": "checkbox2",
        "field": "checkbox2.fieldValue",
        "displayName": "checkbox2",
        "cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
    },
    {
       "name": "checkbox3",
        "field": "checkbox3.fieldValue",
        "displayName": "checkbox3",
        "cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
    }
];

After rendering the html, I am getting an error in the console:

Error: [$parse:syntax] http://errors.angularjs.org/1.5.0-rc.1/$parse/syntax?p0=%7B&p1=invalid%20key&p2=2&p3=%7B%7Bgrid.getCellValue(row%2Col)%7D%7D&p4=%7Bgrid.getCellValue(row%2C%col)%7D%7D

How can I resolve this issue?

1
  • It's hard to know exactly what it is from the error, but you must have some kind of syntax error in your html. The clue for the error is in the query string: p0={&p1=invalid key&p2=2&p3={{grid.getCellValue(row,ol)}}&p4={grid.getCellValue(row,col)}}... You might have misspelled col, or you might be missing an opening curly brace. Would help to see controller/html code, too. Commented Feb 4, 2016 at 19:43

2 Answers 2

3

Tutorial: 201 Edit Feature

try to use 'boolean' type instead of 'checkbox'

Sign up to request clarification or add additional context in comments.

10 Comments

Hi @un.spike, small doubt, i am getting 1000 records from DB, in that two columns check boxes, but after service call UI is not responding properly it is struck for 3 or 4 mins, could you please suggest any idea or any solution for this problem, Thanks in advance !
I am not able to un check the checked check box and, i am not able checked the un checked box, do you have any idea, any thing may wrong, could please suggest. <input type=\"checkbox\" ng-model=\"COL_FIELD\" ng-true-value=\'"Y"\' ng-false-value=\'"N"\'/>
set enableCellEdit : true, in colDef
give me the plinker with your sample
Could you please look into i am sharing the plnker, in my JSON data, filed value is true but check box value is not checked and another object cellTemplate value has link it is not updating, please help me into solve my problem and please check console log please thanks so much
|
0

Both ng-true-value and ng-false-value expect an expression to be passed. When you want to pass a string, it should be passed like: ng-true-value="'Y'".

Example from NG docs: https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D

Try correcting your cell template to fit this.

Comments

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.