2

I am using angular ui-grid currently I am having all rows in which qty cell is editable by double clicking on it. I need to place input type text there and always editable, I am trying like this but when i I am submitting I am not getting values of this for post processes

 vm.gridColumnDefs = [
    {field: 'barcode', name: 'Barcode'},
    {field: 'productname', name: 'Product Name'},
    {field: 'categoryname', name: 'Category Name'},
    {field: 'suppliername', name: 'Supplier Name'},
    {field: 'sticks', name: 'sticks'},
    //{field: 'qty', name: 'quantity', enableCellEdit: true} // this is working fine
    {field: 'qty', name: 'quantity', type:'text', editableCellTemplate: '<input type="text" ng-class="\'colt\' + col.index" ng-input="COL_FIELD" ng-model="COL_FIELD" />'} 

  ];
1
  • can you post a working code snippet using plunker/codepen/jsfiddle etc? That would be helpful to debug your issue Commented May 5, 2018 at 14:19

1 Answer 1

0

In ui-grid you will get field value in row.entity.fieldname in your case you will get qty field value in row.entity.qty. so,bind model like below code, you will get value of qty too. to show input box always use cellTemplate instead of editableCellTemplate.

vm.gridColumnDefs = [
    {field: 'barcode', name: 'Barcode'},
    {field: 'productname', name: 'Product Name'},
    {field: 'categoryname', name: 'Category Name'},
    {field: 'suppliername', name: 'Supplier Name'},
    {field: 'sticks', name: 'sticks'},
    //{field: 'qty', name: 'quantity', enableCellEdit: true} // this is working fine
    {field: 'qty', name: 'quantity', type:'text',enableCellEdit: true, cellTemplate: '<input type="text" ng-class="\'colt\' + col.index" ng-input="COL_FIELD" ng-model="row.entity.qty" />'} 

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

3 Comments

by default when loading first time or anytime, it is not showing cell as text type input, i have to double click on it make it text type
it's ok what is issue?
Actually I need to display input type=text when grid is loaded. I don't need to click on it make it textbox.

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.