Posts by Brunno • 3,531 points
94 posts
-
0
votes2
answers81
viewsA: Inaccessible attribute value
Your problem is due to you being working with asynchronous data. When your application starts, its variable criterias is undefined, and will only receive value when the observable returned by…
-
1
votes2
answers466
viewsA: Passing parameters, he.on('click', func);
You can pass the parameter in sequence, and it will be added in date within the event parameter: function hello(event) { alert(event.data.msg); } $('#ele').on('click', {msg: 'Teste'}, hello); Fiddle…
-
6
votes4
answers299
viewsA: What does the "do" function do in Javascript?
Only by complementing the other responses, and to help in understanding: do /*faça algo*/ while /*enquanto uma condição seja verdadeira*/ :)
-
4
votes2
answers539
viewsA: Docker during the development
Yes you can use the container for development, so you can better understand I’ll make some clarifications. The command CMD will run only once, when your container is starlet. To make a change to…
-
2
votes1
answer1155
viewsA: How to make CRUD buttons on datatables?
Not guaranteed to be the best way, but you can use the columnDefs to accomplish this task: $('#').DataTable({ "processing": true, "serverSide": true, "ajax": "scripts/server_processing.php",…
-
2
votes1
answer488
viewsA: Grab some elements from a JSON variable
To search for range, you can use the .splice() to do this filtering in your array, example: var yourJson = { "estado": [ { ... } ] } result = yourJson.estado.splice(/*inicial*/ 1, /*final*/ 5);…
-
2
votes1
answer207
viewsA: Multiline string with Javascript
You can use a \ at the end to escape the line: var suaString = "primeira linha \ segunda linha"; With Ecmascript 6 you can use it like this: var suaString = `primeira linha segunda linha`;…
-
1
votes1
answer328
viewsA: Generating a New File with an Excel template when Saving
Use the Saveas() Workbook to save with another name, so you will only use Etiqmasterboxtornozeleira.xlsx as template. It’s gonna be something like this: sheet.SaveAs(string.Format("C:\\Users\\Core…
-
2
votes1
answer1179
viewsA: Set Value in a @html.Dropdownlist
If the DropDownList already populated, just do what you did: $("#mydropdownlist").val("thevalue"); You can also add a .change() if it does not reflect the value Already if you have one DropDownList…
-
1
votes3
answers71
viewsA: Catch the week correctly
You can use the Moment.js: var primeiroDia = moment().startOf('isoWeek').toDate(); var ultimoDia = moment().endOf('isoWeek').toDate(); console.log(primeiroDia); console.log(ultimoDia); jsfiddle :)…
-
1
votes2
answers55
viewsA: How to know that called the screen
You can implement this button in two ways by creating the button and in the use click event: window.location.href = '/Administrativo/Cliente/Listar' To redirect to your action, or you can use…
-
5
votes1
answer2526
viewsA: Recover view value for controller
The idea is the same one you posted, create your model to receive in your Action: public class Generic { public int ListarDadosCarteira_Resultado { get; set; } public string…
-
1
votes1
answer329
viewsA: Send multiple values from my Checkbox to an Ajax call
Friend your code is correct, just add one traditional: true your ajax that everything will work. The attributetraditional changes the way data is sent to server, without it ASP.NET cannot bind…
-
1
votes2
answers78
viewsA: How I Address a Partialview ASP MVC
You can create an Action to return you to partialview, and use jQuery .load() to seek and popular its partial. It would look something like this: Action: public PartialViewResult GetPartial() {…
-
1
votes1
answer1591
viewsA: How to show "loading" screen with modal bootstrap in any c#server process
You can do this for all ajax of your application by using the events global. Example: $(document).ajaxSend(function () { ///chama seu processando }); $(document).ajaxComplete(function () {…
-
0
votes1
answer168
viewsA: Request Ajax jquery Jsonp Returning Undefined
success: function(data) { if (data && data.resultCount > 0) { img = data["resultado"][0].imagem; $("html").css({ "background-image": "url(" + img + ")" }); } else { //Se não for…
-
2
votes1
answer503
viewsA: Focus on the last line of the div with scroll
You have to pass the scrollHeight to the scrollTop and the selector must be in the element that will undergo animation: $('.chat-history').animate({ scrollTop: $('.chat-history')[0].scrollHeight },…
-
1
votes2
answers2534
viewsA: Align Framework Cards Materialize
The problem is that you’ve separated the cards into Rows, so it works just by adding them all within the same class row and use the class col to place one side by side. Always remember the grid…
-
3
votes1
answer3483
viewsA: How to center a card panel in materialize css?
You can use the offset to help you in this task: <div class="row"> <div class="col s4 offset-s4 card"> <!-- SEUS FIELDS --> </div> </div> Follows the jsfiddle. You can…
-
4
votes2
answers145
viewsA: Fetch array position from a given term without using the 'inArray' function
You can do using RegExp without needing the jQuery: var fruits = ['banana', 'melao', 'uva', 'melancia']; function matchFruit(input) { var reg = new RegExp(input.split('').join('\\w*').replace(/\W/,…
-
2
votes1
answer2699
viewsA: Data Tables with bootstrap
The process is very simple and is available on the Datatables. Just import all the files in the correct sequence. jQuery >= 1.12 Bootstrap JS / CSS Datatables Bootstrap style for datatables…
-
2
votes1
answer1690
viewsA: Datepicker is shown behind the modal bootstrap
This is usually a problem with the z-index, try adding a value of z-index higher in its Datepicker display class as for example: .suaClassDatePicker { z-index: 100000; }…
-
1
votes1
answer108
viewsA: View|Brush a field when selecting data in Select
Change the options mount to save the index: $.each(val, function(index, val) { optgroup.append($('<option>', { text: val, value: index //index })); }); then just implement in select change to…
-
2
votes1
answer1325
viewsA: How to create a function button to export Datatable to (.csv) in jQuery?
Datatables has an implementation of File Export that does what you need and has a specific topic for csv. In order for everything to work you have to import all the files listed just below the…
-
1
votes3
answers1618
viewsA: How to group equal values with JSON
I got into the groove and did my version manually: Grouping: var items = {}, base, key; $.each(values, function(index, val) { key = val.Estado; if (!items[key]) { items[key] = []; }…
-
4
votes1
answer287
viewsA: Angularjs - page does not find the controller
Add the ng-app in your html tag: <html ng-app="mod">, and remove the injection from your controller in your module, leaving your main.js like this: angular.module('mod', ['ngRoute']);…
-
2
votes1
answer114
viewsA: Find the index of all occurrences in a jquery string
You can use a regex combined with a while to do this: var re = /três/g, idx = [], str = "três tigres..."; while ((match = re.exec(str)) != null) { idx.push(match.index); } Follows the fiddle. An…
-
1
votes2
answers310
viewsA: Json Array for C#string array
You need to create a class according to your Json, and after that just use: JsonConvert.DeserializeObject<SeuObjeto>(stringJson); That he will parse the Json into his class and return the…
-
2
votes1
answer96
viewsA: How to hide title when radio is selected?
A simple solution would be to use the .attr, set a class to change only the radio we want: /*Pego o evento de alteração nos seus radios*/ $('.radioArtigo').change(function() { /*seto a mensagem para…
-
2
votes2
answers972
viewsA: How to change the data type in $.post request in jQuery?
The $.post is a simplification of the normal ajax syntax (I will show it below), if I am not mistaken it is not possible to pass this option in just one request, to solve the problem I advise you to…
-
1
votes1
answer161
viewsA: How to use a Collapsible without an id for the target element?
If the HTML structure does not change, an alternative would be to give Collapse in the next div with the corresponding class, something like: $('a[data-toggle="collapse"]').click(function() {…
-
2
votes2
answers458
viewsA: Require input text filling with jQuery Validator
In order to be mandatory at least one of the three, I suggest creating a rule that takes as parameter a selector (a class for example) common among the other fields for validation, after that you…
-
3
votes1
answer409
viewsA: HTML input that can store multiple values?
No Javascript will not be able to implement. I suggest using a jQuery plugin like Select2. Follow the link to example and a basic example: HTML: <select class="js-example-basic-multiple"…
-
1
votes1
answer41
viewsA: Post com form + string
When you make a .serialize() it generates a querystring, to add parameters in it you can use one of the following ways: (form.serialize() + ("&tipoMeioPublicacao=" + meioPublicacao)); Or you can…
-
1
votes1
answer373
viewsA: Pass multiple data to an input, via a select
I don’t know if it’s the best implementation, but you can solve your problem by changing your function like this: function passar() { var valorA = document.getElementById("valorA"); var nome =…
-
7
votes2
answers18567
viewsA: Pick select selected (only picking first value)
There are some ways to get the value, as there is your HTML I will quote some: If your form does not have the attribute value, something like: <select id="ListaPresenteSelect">…
-
1
votes2
answers49
viewsA: problems when creating dynamically Event listeners
Your problem is happening due to variable totalPerguntas that is getting the value of the last call of the function verificaCamposRepetidos(); To solve this, simply move the variable assignment down…
-
1
votes1
answer405
viewsA: Setting an option value in a jQuery Multiselect dropdown
Seeing the plugin documentation, it already provides you with one method select to help you in this task: $('seuSelect').multiselect('select', ['1', '2', '4']); Follows the jsfiddle I used for…
-
1
votes1
answer651
viewsA: Pass values from one form to another
To do this you will need to use a little Javascript! With it you can use the sessionStorage (a feature of HTML5) to help you in this task. Remember that it can still generate a certain problem with…
-
2
votes2
answers100
viewsA: What is the error in this regular expression?
To add the mask only with Javascript and Regex, I would do as follows: document.getElementById('numero').addEventListener("keyup", mascara); //Pego evento de keyup () function mascara() { var v =…
javascriptanswered Brunno 3,531 -
6
votes1
answer4409
viewsA: Datetime "Null" = 01/01/0001
You can compare the date with the DateTime.MinValue to find out if the date was instantiated without value: DateTime suaData = new DateTime(); if (suaData == DateTime.MinValue) { //operação } And…
-
2
votes2
answers1397
viewsA: How to disable a combobox with a condition in jquery?
To enable and disable a select you can use the codes below respectively: With jQuery: $('.cidades').prop("disabled", true); $('.cidades').prop("disabled", false); Javascript-enabled: var cells =…
-
4
votes3
answers20750
viewsA: How to add option for a select by Jquery/Javascript
The for described in the question will work, you could also do according to the code below: var cidades = [ 'São Paulo', 'Rio de Janeiro', 'Bahia']; cidades.forEach(function(item){…
-
3
votes1
answer75
viewsA: Css code changing entire page layout
You can use a class in your div main and set the css from the same. Thus isolating the style of the div the rest of the layout. Your code would look like this: HTML: <div class="divComImagem">…
-
3
votes3
answers527
viewsA: Take data from the page by javascript and convert it to whole
Follow the solution upon your code: numeroRecuperado = parseInt($('#qualquer span').text().replace(/\D/g,'')); numeroQualquer = 5; total = numeroRecuperado + numeroQualquer; $("#qualquer…
-
3
votes1
answer111
viewsA: Run javascript by clicking on combobox
The event of click you can implement as follows: document.getElementById("combobox").addEventListener("click", eventoClick); function eventoClick() { alert("teste do onclick") } There is also the…
javascriptanswered Brunno 3,531 -
1
votes1
answer228
viewsA: Checkbox status
Use the bootstrap-table’s own functions to catch onCheck() and onUncheck(), this way will work normally with paging. Ai just do your ajax to save your status. See the fiddle! First caught the event…
-
1
votes1
answer41
viewsA: SQL - Select all records with encoding errors
You can check data that is not in UTF-8 comparing the sizes: SELECT * FROM suaTabela WHERE LENGTH(suaColuna) != CHAR_LENGTH(suaColuna) This will return all lines you have multibyte. Follows the…
-
9
votes1
answer2073
viewsA: How to transfer data from one javascript file to another on different pages?
You can do this in two ways, the first one can be using the sessionStorage. That saves data in the brownser and expire next to it. //Utilize esse comando para setar o valor na primeira…
javascriptanswered Brunno 3,531 -
2
votes1
answer647
viewsA: Validate several Emails within input from the enter key with jquery
You can use the keyup() to pick up enter event, use the split(';') in the point and comma to take the last email and also use regex below to validate it. The solution below validates the email, if…