Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - KaranamAvinash

Pages: [1]
1
ParamQuery Pro Evaluation Support / HTTP headers in Angular 8
« on: January 29, 2020, 01:39:32 pm »
Hi,

I am using Angular 8 with remote calls to database to fetch data.

I am unable to send http header while performing the remote calls. How do I send HTTP Headers.?

The requests sent, are not getting registered in the HTTP Interceptor to add custom header for doing remote database calls.

Thanks in advance.

2
Hi,

Thanks for your answer but what code should be written in the refreshDataAndView() public method in the angular.

How to manually call the remote api to fetch data again into the grid from the parent Component in the angular.

Thanks.

3
Hi,

I am using Angular 8 with remote calls to database to fetch data.

I have a function which will  update the database values, but changes in grids shows up only when i refresh the grid. As mention in the demo's i tried using refreshDataAndView(), but didn't figure out how to use it angular.

Thanks in advance.

4
ParamQuery Pro Evaluation Support / Re: ParamQuery With Angular 8
« on: September 24, 2019, 03:16:03 pm »
Thank you,

I missed it. Now it's  working perfectly fine.

Just i have an another question?

In post render how can we call refreshDataAndView() method.

5
Thank you Paramvir,

Actually my question was wrong,  it was about clubbing of all the three together.

Remote paging with sorting and filtering.

and its sorted out.

6
ParamQuery Pro Evaluation Support / Re: ParamQuery With Angular 8
« on: September 20, 2019, 12:00:27 pm »
Here is the StackBlitz example.

As of now paramquery isn't working in the stackblitz.

https://stackblitz.com/edit/angular-aztcnm

Thank you.

7
Hi,

I am using paramquery grid with angular 8 in the frontend and ASP .Net MVC in the backend.

Could anyone provide a demo code for remote Paging, Filtering and Sorting.


Thank you.

8
ParamQuery Pro Evaluation Support / ParamQuery With Angular 8
« on: September 19, 2019, 05:59:53 pm »
Hi,

I am using Paramquery grid with Angular 8 application. I am unable to call the functions present in the component from the buttons present in the data row and unable to use variables present in that component from the post render present in the colModel. 

Please help me put with this.

Below is the code snippet.


*Component.ts*
______________________________________________________________________

import { Component, OnInit, ViewChild } from '@angular/core';
import { PqgridComponent } from 'src/app/pqgrid.component';
import pq from 'pqgrid';
import { Router } from '@angular/router';
import { ModalDirective } from 'ngx-bootstrap';
import { FormGroup, FormBuilder, FormControl, Validators, FormControlName } from '@angular/forms';

@Component({
  selector: 'app-manage-roles',
  templateUrl: './manage-roles.component.html',
  styleUrls: ['./manage-roles.component.scss']
})
export class ManageRolesComponent implements OnInit {

  @ViewChild('gridRoles', { static: false }) grid: PqgridComponent;
  @ViewChild('addEditRoleModal', { static: false }) addEditRoleModal: ModalDirective;
  gridRolesOptions: pq.gridT.options;

  data = [
    { role: "Staff User", roleDescription: "Staff User", assignedUsers: "2", permissions: "4/5", status: "Active" },
    { role: "Manager", roleDescription: "Manager", assignedUsers: "1", permissions: "5/5", status: "Active" },
  ]

  columns = [
    { title: "Role", dataType: "string", dataIndx: "role" },
    { title: "Description", dataType: "string", dataIndx: "roleDescription" },
    { title: "Assigned Users", dataType: "string", dataIndx: "assignedUsers", align: "center" },
    { title: "Permissions", dataType: "string", dataIndx: "permissions", align: "center" },
    { title: "Status", dataType: "string", dataIndx: "status", align: "center" },
    {
      title: "Actions", editable: false, minWidth: 165, sortable: false, align: "center",
      render: function (ui) {
        return "<button type='button' class='edit_btn'>Edit</button>\
                <button type='button' class='delete_btn'>Delete</button>";
      },
      postRender: function (ui) {
        var rowIndx = ui.rowIndx,
          grid = this,
          $cell = grid.getCell(ui);
        //edit button
        $cell.find(".edit_btn").button({ icons: { primary: 'ui-icon-pencil' } })
          .off("click")
          .on("click", function (evt) {
            // console.log(grid.pdata[rowIndx]);
          });
        //delete button
        $cell.find(".delete_btn")
          .button({ icons: { primary: 'ui-icon-close' } }).off("click")
          .on("click", function (evt) {
            grid.deleteRow({ rowIndx: ui.rowIndx });
          });
      }
    }
  ]

  submitted = false;

  constructor(private _router: Router, private _fb: FormBuilder) {
    var self = this;
    this.gridRolesOptions = {
      scrollModel: { autoFit: true },
      title: "Manage Roles",
      columnTemplate: { render: this.tooltipRender, width: 100 },
      showTop: true,
      reactive: true,
      locale: 'en',
      height: "flex",
      stripeRows: true,
      numberCell: {
        show: false
      },
      selectionModel: { type: 'none' },

      filterModel: {
        on: true,
        mode: "AND",
        header: false,
        menuIcon: true //show filter row icon initially.
      },
      postRenderInterval: -1,
      menuIcon: true, //show header menu icon initially.
      menuUI: {
        tabs: ['filter'] //display only filter tab.
      },
      toolbar: {

        items: [
          {
            type: 'button',
            icon: 'ui-icon-plus',
            label: 'Reset filters',
            listener: function () {
              this.reset({ filter: true });
            }
          }
        ]
      },
      collapsible: { on: true, collapsed: false },
      pageModel: { type: 'local' },
      colModel: this.columns,
      editable: false,
      swipeModel: { on: false },
      animModel: {
        on: true
      },
      sort: function (evt, ui) {
        self.onSort(evt, ui);
      },
      dataModel: {
        data: this.data
      }
    }
  }

  roleForm: FormGroup;

  ngOnInit() {
    this.formInit();
  }

  formInit() {
    this.roleForm = this._fb.group({
      roleName: new FormControl(null, Validators.required),
      roleStatus: new FormControl(null, Validators.required),
      roleDescription: new FormControl(null)
    });

  }
  // convenience getter for easy access to form fields
  get f() { return this.roleForm.controls; }

  onSubmit() {
    this.submitted = true;
    // stop here if form is invalid
    if (this.roleForm.invalid) {
      return;
    }
    console.log(this.roleForm.value);
    this.addEditRole(0);
  }

  tooltipRender(ui) {
    return {
      //here we inject html title attribute in each cell.
      attr: 'title="' + ui.formatVal + '"'
    }
  }

  onSort(evt, ui) {
    JSON.stringify(ui.sorter);
  }

  addEditRole(val) {
    this.submitted = false;
    // this.formInit()
    if (val == 1) {
      this.addEditRoleModal.show();
    }
    else
      this.addEditRoleModal.hide();
  }
}



*Html code*
________________________________________________________________

<div class="row">
    <div class="col-xs-12">
        <button mat-raised-button color="accent" class="pull-right m-b-10" (click)="addEditRole(1)">
            <mat-icon>add</mat-icon> Add Role
        </button>
    </div>
    <div class="col-xs-12">
        <pqgrid #gridRoles [options]="gridRolesOptions"></pqgrid>
    </div>
</div>




<!--Add edit Note modal pop up-->
<div bsModal #addEditRoleModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="dialog-sizes-name1" [config]="{backdrop: 'static'}">
    <form [formGroup]="roleForm" (ngSubmit)="onSubmit()">
        <bs-modal-backdrop></bs-modal-backdrop>
        <div class="modal-dialog modal-md">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 id="dialog-sizes-name1" class="modal-title pull-left">Add Role</h4>
                    <button type="button" class="close pull-right" (click)="addEditRole(0)" aria-label="Close">
                        <span aria-hidden="true" class="text-white">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-12 col-sm-6">
                            <div class="form-group">
                                <label class="mandatory">Role Name :</label>
                                <input [type]="type" class="form-control" placeholder="Role Name"
                                    formControlName="roleName"
                                    [ngClass]="{ 'is-invalid': submitted && f.roleName.errors }">
                                <div *ngIf="submitted && f.roleName.errors" class="invalid-feedback">
                                    <div *ngIf="f.roleName.errors.required">Role Name is required</div>
                                </div>
                            </div>
                        </div>
                        <!-- <app-input-feild label="Role Name" type="text" class="col-xs-12 col-sm-6">
                        </app-input-feild> -->
                        <div class="col-sm-6 col-xs-12">
                            <div class="form-group">
                                <label class="mandatory" for="Status">Status :</label>
                                <select name="" id="" placeholder="Select Status" class="form-control"
                                    [ngClass]="{ 'is-invalid': submitted && f.roleStatus.errors }"
                                    formControlName="roleStatus">
                                    <option value="null" selected disabled>Select</option>
                                    <option value="1">Active</option>
                                    <option value="2">InActive</option>
                                </select>
                                <div *ngIf="submitted && f.roleStatus.errors" class="invalid-feedback">
                                    <div *ngIf="f.roleStatus.errors.required">Role Status is required</div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class="form-group">
                                <label>Role Description :</label>
                                <textarea rows="2" class="form-control" placeholder="Role Description"
                                    formControlName="roleDescription"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <div class="row">
                        <div class="col-sm-12">
                            <button mat-raised-button type="submit" class="pull-right btn-success">Save</button>
                            <button mat-raised-button type="button" (click)="addEditRole(0)"
                                class="pull-right m-r-5 btn-secondary">Cancel</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>



Pages: [1]