Forum Replies Created

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • in reply to: Updatebounddata does not work Updatebounddata does not work #107500

    Novato
    Participant

    Hi Hristo.

    I don’t have any console errors when running updatebounddata.

    What I have seen in your example and in the documentation for this to work are these two lines.

    
        source.localdata = generatedata(10);
        $("#jqxgrid").jqxGrid("updatebounddata", "cells");
    

    In your example, commenting on this line and executing it does not update the data.

    
        //** source.localdata = generatedata(10); // commented line
        $("#jqxgrid").jqxGrid("updatebounddata", "cells");
    

    In my case I only put this line that is why it does not work.

    
    $("#gvData").jqxGrid("updatebounddata", "cells");
    

    This is my complete code, I work with dynamic columns and step parameters. As I mentioned above when using the function to update my grid it is not updated, I still see the same status after inserting. I can see the new status only if I refresh the page and check the data again.

    Can you tell me how I can use your function to update the grid?

    Thank you very much.

    
    
    function get_information() {
    
        var person = $("[id*=ddlPerson]").val(); //dropdownlist person
        var Branch = "";
     
        if (persona != 0) {
                  
    	var values;
            var datafields = new Array();
            var columns = new Array();
            var columnsArray = [];
          
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "frmPerson.aspx/Information_person",
                contentType: "application/json; charset=utf-8",
                data: '{id_person:"' + person + '",Sucursal:"' + Branch + '"}',
                async: false,
    
                success: function(data) {
    
                    if (data != '') {
              
                        values = JSON.parse(values[0]);
    				
    	/**************************************  This is my dinamyc columns    ***********************************************************/
                        for (var i in values[0]) {
                            datafields.push({ name: i, type: 'string' });
                            columns.push({ text: i, datafield: i, filtercondition: 'CONTAINS', align: 'center', minwidth: 100 });
    						
                        }
    
                        for (var j = 1; j < columns.length; j++) {
                            columnsArray.push(columns[j]);
                          
                        }
    	
    	/**********************************************************************************************************************************/
    
                    }
    
                    var gridSource =
                    {
                        datatype: "json",
                        datafields: datafields,
                        localdata: values, 
                        async: false
                       
                    };
    
                    var gridDataAdapter = new $.jqx.dataAdapter(gridSource);
    
                    var editrow = -1;
    
                    columnsArray.push({ text: 'Add', datafield: 'Edit', filtercondition: 'CONTAINS', align: 'center', minwidth: 100, columntype: 'button', cellclassname: "color_especial",  
                        cellsrenderer: function() { },
                        buttonclick: function(row) {
    
                            editrow = row;
                           
        /*******************  Here I get the data I just put some data as an example ***************/
    	
    						 var datarecord = $("#gvData").jqxGrid('getrowdata', editrow);
    
                            var person_name = $("#gvData").jqxGrid('getcolumnat', 1).datafield;
                            var person_age = $("#gvData").jqxGrid('getcolumnat', 2).datafield;
    					    var payment1 = $("#gvData").jqxGrid('getcolumnat', 3).datafield;
    						var payment2 = $("#gvData").jqxGrid('getcolumnat', 4).datafield;
    						var payment3 = $("#gvData").jqxGrid('getcolumnat', 5).datafield;			
                          
                            $("#txtName_Person").val(dataRecord[name_person]);
                            $("#txtAge_Person").val(dataRecord[age_person]);
    						$("#txtPayment1").val(dataRecord[payment1]);
    						$("#txtPayment2").val(dataRecord[payment2]);
    						$("#txtPayment3").val(dataRecord[payment3]);
                        
                         //Popup bootstrap display data in the input text. 
                           $("#Popup_AddData").modal('show');
                        }
                    });
    			
    
                    $("#gvData").jqxGrid({
                        source: gridDataAdapter,
    	            editable:false,
                        width: '100%',
                        columnsresize: true,
                        autoheight: false,
                        autorowheight: false,
                        pageable: true,
                        showfilterrow: true,
                        filterable: true,                 
                        handlekeyboardnavigation: function(event) {
                            var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
                            if (key == 13) {                           
                                return true;
                            }
                            else if (key == 27) {                         
                                return true;
                            }
                        },
    
                        columns: columnsArray
                    });
    				
    				
    	//******  This is the button to add the data to the database this button is within the modal *********//
    				
              $("#btnAcept").click(function() {
    					 
    		$.ajax({
                            type: "POST",
                            datatype: "json",
                            url: "frmPerson.aspx/Payment_person",
                            contentType: "application/json; charset=utf-8",
                            data: '{person_name:"' + $("#txtName_Person").val() + '",person_age:"' + Number(("#txtAge_Person").val())+ '",payment1:"' + Number(("#txtPayment1").val()) + '",payment2:"' + Number(("#txtPayment2").val()) + '",payment3:"' + Number(("#txtPayment2").val()) + '"}',
                            cache: false,
                            success: function(data) {
                               
    		 //******** here I update my grid but it doesn't update me ******//
    			
                        $('#gvData').jqxGrid('updatebounddata');
    		//$('#gvData').jqxGrid('updatebounddata', 'cells');						   
    						   
                            },
                            error: function(error) {
                                alert(error.responseText);
                                console.log(error.responseText);
                                jsonValue = jQuery.parseJSON(Error.responseText);
                                alert(error.respose.Text);
                                alert("Error");
                            }
                        }); 
    			 
    					 
    		});
    
                },
    
                error: function(error) {
                    alert(error.responseText);
                    console.log(error.responseText);
                    jsonValue = jQuery.parseJSON(Error.responseText);
                    alert(error.respose.Text);
                    alert("Error");
                }
            });
    
        }
       
    }
    
    
    • This reply was modified 3 years, 9 months ago by  Novato. Reason: edit code

    Novato
    Participant

    Hi admin,

    Hi, can you give me an example with the code I published?

    Thank you very much


    Novato
    Participant

    Hi Hristo.

    I am doing the following:

    I have a main grid with its nested grid, the main grid has a column of buttons where by clicking I show information in a bootstrap modal.

    My grid has a checkbox type column where when you check the checkbox the button disables to not show the information in the modal.

    I am guided by this example:

    My problem is the following:
    When executing my code you have an error in this code:

    Code:

    
     if (data.Aprobar) {
                        $('button{rowId}').jqxButton({ disabled: true });                                             
                       }
    

    Error:

    
    Uncaught Error: Syntax error, unrecognized expression: button{rowId}
        at Function.oe.error (jquery-3.3.1.min.js:2)
        at oe.tokenize (jquery-3.3.1.min.js:2)
        at oe.select (jquery-3.3.1.min.js:2)
        at Function.oe [as find] (jquery-3.3.1.min.js:2)
        at w.fn.init.find (jquery-3.3.1.min.js:2)
        at new w.fn.init (jquery-3.3.1.min.js:2)
        at w (jquery-3.3.1.min.js:2)
        at createwidget (ConsultaBI.js:1628)
        at c.<computed>._renderwidgetcell (jqxgrid.js:8)
        at _rendercell (jqxgrid.js:8)
    

    Also use the code as in the example:

    
    if (data.Aprobar) {
                        $('.btn-${rowId}').jqxButton({ disabled: true });                  
                       }
    

    Error:

    
    Uncaught Error: Syntax error, unrecognized expression: .btn-${rowId}
        at Function.oe.error (jquery-3.3.1.min.js:2)
        at oe.tokenize (jquery-3.3.1.min.js:2)
        at oe.select (jquery-3.3.1.min.js:2)
        at Function.oe [as find] (jquery-3.3.1.min.js:2)
        at w.fn.init.find (jquery-3.3.1.min.js:2)
        at new w.fn.init (jquery-3.3.1.min.js:2)
        at w (jquery-3.3.1.min.js:2)
        at createwidget (ConsultaBI.js:1631)
        at c.<computed>._renderwidgetcell (jqxgrid.js:8)
        at _rendercell (jqxgrid.js:8)
    

    I could solve it with the following code and add the cellbeginedit property to my column.

    
    if (data.Aprobar) {
      $('button').jqxButton({ disabled: true });
    }
    


    My question is:
    How to deactivate or activate the entire column of buttons when clicking a button that is outside the main grid?


    Novato
    Participant

    Hi, thanks. I have been able to solve my problem.


    Novato
    Participant

    Hi, thanks. I have been able to solve my problem.


    Novato
    Participant

    Hi, thanks. I have been able to solve my problem.


    Novato
    Participant

    Hi Todor.

    This example works great for me but I have encountered a problem and that is that by filtering through the textbox using the showfilterrow property on my main grid I can no longer obtain the data as you mention me.

    Any idea how to fix this?

    Thank you.


    Novato
    Participant

    Hi Todor.

    Thanks for the example it worked perfectly.


    Novato
    Participant

    Thanks, I was able to solve the problem.


    Novato
    Participant

    Hi Todor.

    Thanks for the example it worked for me but with the pointer-events property it doesn’t work with internet explorer 10 you know of another property with the same functionality as pointer-events.

    I hope you can answer me soon and thank you very much.


    Novato
    Participant

    Hi Todor

    Thanks for your help this works well.


    Novato
    Participant

    Hello

    Thank you but I have already solved this problem.


    Novato
    Participant

    Hi Hristo

    I have managed to solve this, thank you very much for your help.


    Novato
    Participant

    Hi, Todor.

    Sorry to take a while to respond, display: none worked well for my needs.


    Novato
    Participant

    Hi, Todor.

    I destroyed the grid and showed the excel data in a new grid and it worked perfectly.

    But after I need to load the data from my destroyed first grid again, the problem I notice is that the destroy method removes the element from the Dom.

    Any suggestions to show the data again in the destroyed grid?

    I would really appreciate it if you can answer me as quickly as possible thank you very much.

Viewing 15 posts - 1 through 15 (of 26 total)