jQWidgets Forums
Forum Replies Created
-
Author
-
December 2, 2015 at 5:20 pm in reply to: Cascading Combobox with noneditable field Cascading Combobox with noneditable field #78818
Crap, that meant to read:
alert (dataPairs["France"]);
December 2, 2015 at 5:06 pm in reply to: Cascading Combobox with noneditable field Cascading Combobox with noneditable field #78815Sorry 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.
December 2, 2015 at 3:31 pm in reply to: Cascading Combobox with noneditable field Cascading Combobox with noneditable field #78810For:
`var newValue = data[newvalue] || “None”;’
Did you mean to write:
var newValue = dataPairs[newvalue] || "None";
?December 2, 2015 at 3:17 pm in reply to: Cascading Combobox with noneditable field Cascading Combobox with noneditable field #78808Thank you very much, this is a lot better!
December 1, 2015 at 7:58 pm in reply to: ReferenceError: data is not defined ReferenceError: data is not defined #78760…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.
I found my answer here.
It’s funny how us programmers can overthink things!
I’m getting it now: I will also need to add the addrow, deleterow and updaterow functions to the subgrid, as well.
That would make sense to apply a filter. Thank you, ivalio!
November 20, 2015 at 2:00 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78390One 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.
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?
November 19, 2015 at 3:08 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78349And 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!
November 18, 2015 at 10:50 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78318It 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)
November 18, 2015 at 8:44 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78314After 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!
November 16, 2015 at 4:53 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78214Update: 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.
November 13, 2015 at 8:13 pm in reply to: ASP Classic and updaterow ASP Classic and updaterow #78128I’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.
-
AuthorPosts