jQWidgets Forums
jQuery UI Widgets › Forums › Angular › How can I disable / hide a button from the column in angular
This topic contains 6 replies, has 2 voices, and was last updated by Martin 6 years, 4 months ago.
-
Author
-
How can I disable / hide a button from the column by checking a condition using jqxgrid, I am trying to troubleshoot the buttonclick() event, I find similar queries but I do not have a solution to my case. I found,
https://www.jqwidgets.com/community/topic/disablehide-a-button-from-column/
I do a load type of dynamic columns, below my code,
loadColumns(data, localdata){ let columns = [] for (let key in data) { let column = { pinned: false, editable: false, text: key, columntype: 'button', cellsRenderer: (row: number, column: any, value: any, defaulthtml: string, columnproperties: any, rowdata: any) => { return "Download"; }, buttonClick: (row, a): void => { let files = localdata[row].arquivos console.log(localdata) for (var indice in arquivos) { if (arquivos.hasOwnProperty(indice) && key == indice) { var nomeApresentacao = localdata[row].arquivos[indice].nomeApresentacao; this.service.baixarArquivo(nomeApresentacao).subscribe( response => { var blob = new Blob( [response], { type: localdata[row].arquivos[indice].mimeType }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.setAttribute('href', url); a.download = nomeApresentacao; a.click(); } ); } } } }
however as I am using the angle, you can not call the event of the button click shown in the example of the link above, redrawing the button, I wonder if there is a possible example for angular technology ?.
Hello kleyton,
Please, look at the following Example.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Martin, Thank you, it will help me a lot!
Hello martin, I am not having success according to the example, in my solution, tends renderizar in the way that was shown in the example however I am not getting in fact to include the functionality of the button, I tested and always the mistake is presented of (ERROR Error: Invalid Selector -.downloadButton! Please, check whether the used ID or CSS Class name i correct.), that that is the class instanciada in the method of the type void to pay (), however it is presented mistake that was mentioned.
is some other example possible for the solution in subject?, at once I thank.Hello kleyton,
You will get this error if you try using
jqwidgets.createInstance
before the divs with that class(.downloadButton) are created.
That is why in the example I’ve sent you, there is a check:if (!this.firstRender)
inside the render method, before callingcreateInstance
.
Please, make sure that you have not missed it.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Good afternoon, martin!
in the case of the grid (in my case, using angular in specific), I am accessing data consumed through an API in the rest pattern, and the data is presented after a query via get, depending on the type of query that the grid is loaded in when the data is loaded, I would like to know if, in this situation, the grid has some function that, when loading and placing the request, it is possible to place a load on the page to obtain information for the user when the request is being required I have some example template, grateful already.
Hello kleyton,
Could you clarify what you are trying to achieve? What information do you need to obtain? Do you need it before or after sending the get request?
The data adapter have the following callbacks, which might be useful:beforeSend(jqXHR, settings): A pre-request callback function that can be used to modify the jqXHR
loadError(jqXHR, status, error): A callback function called when the request has failed.
downloadComplete(edata, textStatus, jqXHR): A callback function which is called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR.
beforeLoadComplete: A callback function which is called before the data is fully loaded. The function gets passed two arguments: The loaded records. The second argument is the original data. If the function returns an array, the dataAdapter’s records field will be set to it.
loadComplete: A callback function which is called when the data is fully loaded.
loadServerData: A callback function which allows you to manually handle the ajax calls through the jqxDataAdapter. The function gets passed three arguments: The data to be sent to the server, the source object which initializes the jqxDataAdapter plug-in and a callback function to be called when the ajax call is handled.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.