Toolbar Service Custom

Hi Team,

When I add toolbar to my grid with "Add, Edit" buttons, can I use that buttons with custom actions?
I want add button and adapt by business requirements?

5 Replies

MA Marko September 16, 2018 05:00 PM UTC

Just one more question.

I searching dialog editing and it's ok, but I got Information from web api like this.


"result": [
{
"name": "Redacted",
"assetNumber": "Redacted",
"serialNumber": "Redacted",
"modelNumber": "Redacted",
"externalLink": "Redacted",
"barcode": "Redacted",
"purchaseDate": "Redacted",
"endWarranty": "Redacted",
"category": "Redacted",
"type": "Redacted",
"manufacture": "Redacted",
"status": "Redacted"
}
"count": 12
]
When I want add new record over dialog I need array of category, type, manufacture, status.
When I click Add I got something like 


Manufacture, Category need to be dropdown with results which I got from my backend.

When I want post new record, post need be like this

{
     "name":"somevalue",
     "categoryId":1,
     "manufactureId": 3,
      "statusId": 2,
}



MA Marko September 16, 2018 08:54 PM UTC

Hi Team,

I resolved this problem. You can close this case.

Thank you!


VA Venkatesh Ayothi Raman Syncfusion Team September 17, 2018 06:47 AM UTC

Hi Marko, 
 
 
Thanks for the update. 
 
We are very happy to hear that your requirement is achieved.  
 
Regards,
Venkatesh Ayothiraman. 



MA Marko September 17, 2018 07:15 AM UTC

Hi,

Sorry, but I have one more question.

When I update or add record I use WebApi Adaptor  my questions is:
When I got from backend status Ok or Created I want show toastr message.

Does WebApi Adaptor have something like HttpResponse? 


VA Venkatesh Ayothi Raman Syncfusion Team September 18, 2018 09:44 AM UTC

Hi Marko, 

You can achieve your requirement by overriding the successHandler method() of AJAX call using customAdaptor. We have prepared a simple sample based on your query. Please refer to the below code example, Documentation link and sample link. 

[component.ts] 
 
@Component({ 
    selector: 'fetchdata', 
    templateUrl: './fetchdata.component.html', 
    encapsulation: ViewEncapsulation.Emulated 
}) 
export class FetchDataComponent { 
    .  .  . 
    @ViewChild('grid') 
    public grid: GridComponent; 
 
    ngOnInit(): void { 
        this.data = new DataManager({ 
            url: 'api/Orders', 
            adaptor: new CustomAdaptor() 
        }); 
            .  .  . 
 
    } 
} 
 
class CustomAdaptor extends WebApiAdaptor { 
    
    public beforeSend(datamanager: DataManager, request: XMLHttpRequest, ajax: Ajax) { 
        ajax.successHandler = function (data:any) { 
            if (this.onSuccess) { 
               //  here you can get the httpRequest and AJAX 
                if (this.httpRequest.statusText == "OK" && this.options.type == "POST" || this.options.type == "PUT" )) { 
                    alert("Success"); 
                } 
                this.onSuccess(data, this); 
            } 
            return data; 
 
        } 
    } 
} 




Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon