jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 51 total)
  • Author
    Posts

  • RedantJ
    Participant

    Crap, that meant to read:

    alert (dataPairs["France"]);


    RedantJ
    Participant

    Sorry to trouble you again:

    I’ve made some mistakes with the code posted, but it gave me an idea.

                    columns: [
                                  {
                                  text: 'Country', datafield: 'Country', width: 150, columntype: 'combobox',
                                  cellvaluechanging: function (row, datafield, columntype, oldvalue, newvalue) {
                                      var dataPairs = {"Belgium":"Brussels", "France":"Paris", "USA":"Los Angeles"};
                                      var newValue = dataPairs[newvalue] || "None";
                                      $("#jqxgrid").jqxGrid('setcellvalue', row, "City", newValue);
                                  }
                                  },
                                  {
                                  text: 'City', datafield: 'City', width: 150, columntype: 'textbox', editable: false}
                     ]

    With this line:
    $("#jqxgrid").jqxGrid('setcellvalue', row, "City", newValue);
    When I changed the value from “France” to “Belgium”, the value switched from “Paris” to “None”.

    However, when I typed it in like this:
    $("#jqxgrid").jqxGrid('setcellvalue', row, "City", newvalue);
    When I changed the value from “France” to “Belgium”, the value switched from “Paris” to “Belgium”.

    Also, when I try the line:
    alert (dataPairs["France")]);

    “Paris” does come out as expected.

    This tells me newvalue is working the way it’s supposed to.


    RedantJ
    Participant

    For:

    `var newValue = data[newvalue] || “None”;’

    Did you mean to write:

    var newValue = dataPairs[newvalue] || "None"; ?


    RedantJ
    Participant

    Thank you very much, this is a lot better!


    RedantJ
    Participant

    …well, (grunt)…I had:

    });

    placed at the wrong place in the code.

    That had the effect of closing off:

    $(document).ready(function () {

    Watch for that, programmers. It’s an easy error to make.

    in reply to: Changing cell value Changing cell value #78720

    RedantJ
    Participant

    I found my answer here.

    It’s funny how us programmers can overthink things!

    in reply to: Nested grids Nested grids #78715

    RedantJ
    Participant

    I’m getting it now: I will also need to add the addrow, deleterow and updaterow functions to the subgrid, as well.

    in reply to: Nested grids Nested grids #78712

    RedantJ
    Participant

    That would make sense to apply a filter. Thank you, ivalio!

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78390

    RedantJ
    Participant

    One more thing:

    As far as security goes, using GET in your ajax isn’t secure. I would use GET for testing purposes (to be sure the data is going from your grid to your controller). For a more secure page, use POST:

    (this is addrow)

    		var data = "action=insert&" + $.param(rowdata);
    		$.ajax({
    			type: "POST",
    			url: "controller.asp",
    			data: data,
    			success : function(data, status, xhr) 
    			{
    		                commit(true);
    			},
    			        error: function(jqXHR, textStatus, errorThrown)
    			{
    				commit(false);
    			}
    		});
                    },

    and in controller:

    strIndex = Request.Form("idxUID")
    strAction = Request.Form("action")

    And now it’s more secure.

    in reply to: Automatic fill-in Automatic fill-in #78353

    RedantJ
    Participant

    Strike this question.

    I realized I can accomplish this goal on the server side. Plus I was informed that this is going to be dealt with on a later application.

    Can someone delete this post, please?

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78349

    RedantJ
    Participant

    And that’s done:

    When generating a blank row:

    	var generaterow = function (i) {
            var row = {};
    	row["idxUID"] = i;
    	row["foo1"] = "";
            row["foo2"] = "";
            return row;
    	}

    and here:

                // create new row.
                $("#addrowbutton").bind('click', function () {
    		var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;			
                    var datarow = generaterow(rowscount + 1);
    		var commit = $("#jqxgrid").jqxGrid('addrow', null, datarow);
                });

    …when using it inside of a function, for example addrow:

    	var data = "action=insert&" + $.param(rowdata);
    	$.ajax({
    		type: "GET",
    		url: "controller.asp",
    		data: data,
    		success : function(d) {
    			commit(true);
    			alert("added!");
    		}
    	});
            },

    This generates:

    http://localhost/blah/controller.asp?action=insert&idxUID=41&foo1=&foo2=

    Which makes controller.asp:

    <%dim conn, strIndex
    
    Set conn = Server.CreateObject("ADODB.Connection")
    
    strIndex = Request.QueryString("idxUID")
    strAction = Request.QueryString("action")
    
    Conn.open "PROVIDER = MICROSOFT.JET.OLEDB.4.0;DATA SOURCE = C:\blah\FooData.mdb"
    
    intComp = StrComp(strAction, "insert", vbTextCompare)
    
    if (intComp = 0) then
    	sql = "INSERT INTO tblTable (index) "
    	sql = sql + "VALUES (" & strIndex & ")"
    	conn.Execute(sql)	
    end if
    
    conn.close

    So now it works!

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78318

    RedantJ
    Participant

    It looks like what I will need to implement for ASP Classic will be similar to this. I will work on it for the rest of the week.

    (The wheels are turning, however slowly)

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78314

    RedantJ
    Participant

    After dealing with priorities, I’m back at work on this project.

    The IIS issue has been resolved. I’m still perfecting the code, the following works pretty good:

    Main page:

                   updaterow: function (rowid, newdata, commit) {
                        // synchronize with the server - send update command
                        // call commit with parameter true if the synchronization with the server is successful 
                        // and with parameter false if the synchronization failed.
    					$.ajax({
    						type:"POST",
    						url: "update.asp",
    						data: newdata,
    							success : function(d) {
    			                    commit(true);
    								alert("updated!");
    							}
    						});
                    }

    ….and on Update.asp:

    <%dim conn, strFoo1, strFoo2
    
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Mode = 3
    
    strFoo1 = Request.Form("Foo1")
    strFoo2 = Request.Form("Foo2")
    
    Conn.open "PROVIDER = MICROSOFT.JET.OLEDB.4.0;DATA SOURCE = C:\inetpub\wwwroot\HoldingBin\InvntryData.mdb"
    
    sql = "INSERT INTO tblTable (Foo1, Foo2) "
    sql = sql + "VALUES ('" & strFoo1 & "','" & strFoo2 & "')"
    
    conn.Execute(sql)	
    conn.close

    There is still a lot of tinkering to do. The ajax passes on the data to update.asp the way I expected it to do, the SQL statement needs work, and I’m pretty sure I will need to add an index column for this to work right. I’m a few steps closer to where I need to be.

    Thanks guys!

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78214

    RedantJ
    Participant

    Update: The Ajax POST method does work and will require some tinkering. I am dealing with an issue that is Microsoft Access / IIS related at the moment.

    in reply to: ASP Classic and updaterow ASP Classic and updaterow #78128

    RedantJ
    Participant

    I’m thinking about a workaround of this problem using POST. If I’m able to POST the data that I need to update.asp, then it would just be a matter of requesting the data and I can continue onwards. I didn’t have any time this week to try it out this week on account of other priorities. I’ll post up when I succeed.

Viewing 15 posts - 31 through 45 (of 51 total)