jQWidgets Forums
Forum Replies Created
-
Author
-
October 31, 2013 at 4:29 pm in reply to: Change label of aggregates Change label of aggregates #31705
Thanks Dimitar!
Here is what I did (it may not be the best way)…
aggregatesrenderer: function (aggregates, column, element) {
var totallength = 0
$.each(aggregates, function (key, value) {
totallength = value;
});
var renderstring = “Total: ” + totallength + ““;
return renderstring;October 31, 2013 at 1:53 am in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31657I figured it out…It was having a problem with this statement…var rec = $.param(rowdata).split(“&”);”
I changed the updaterow function to this…
updaterow: function (rowid, rowdata, commit) {
$.ajax({
type: “POST”,
url: “CNSTWebService.asmx/UpdateCNSTEngineersEstimateItem”,
contentType: “application/json; charset=utf-8”,
dataType: “json”,
data: ‘{“estimateitemid”:”‘ + rowdata.EstimateItemID + ‘”,”itemnbr”:”‘ + rowdata.ItemNbr + ‘”,”itemdesc”:”‘ + rowdata.ItemDescription + ‘”,”itemunit”:”‘ + rowdata.ItemUnit + ‘”,”itemqty”:”‘ + rowdata.ItemQuantity + ‘”,”itemprice”:”‘ + rowdata.ItemPrice + ‘”}’,
success: function (data) {
commit(true);
GetItems()
}
});
},October 30, 2013 at 7:03 pm in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31651It is XML,
I copied example from http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/cellediting.htm and put alert statement in the update row function and the “+” signs were there too in place of spaces.
localdata: data,
datatype: “array”,
updaterow: function (rowid, rowdata, commit) {
var rec = $.param(rowdata).split(“&”);
alert(rec);
var rowindex = $(“#jqxgrid”).jqxGrid(‘getrowboundindexbyid’, rowid);
editedRows.push({ index: rowindex, data: rowdata });
commit(true);
},Does it have something to do with this statement “var rec = $.param(rowdata).split(“&”);”?
October 30, 2013 at 3:31 pm in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31644Here is how the grid is populated, do you see anything there?
datafields: [
{ name: ‘EstimateItemID’ },
{ name: ‘ItemNbr’ },
{ name: ‘ItemDescription’ },
{ name: ‘ItemUnit’ },
{ name: ‘ItemQuantity’ },
{ name: ‘ItemPrice’, type: ‘number’ },
{ name: ‘ItemTotal’, type: ‘number’ }
],
async: false,
record: ‘Table’,
url: ‘CNSTWebService.asmx/GetCustomers’,
data: { estimateid: $(‘#cmbVersion’).children(“:selected”).attr(“id”) }
};var dataAdapter = new $.jqx.dataAdapter(source, { contentType: ‘application/json; charset=utf-8’ });
Here is Web Service…
_
_
Public Function GetCustomers(estimateid) As String
‘Dim query As String = “SELECT EstimateItemID, ItemNbr, ItemDescription, ItemUnit, ItemQuantity, ItemPrice FROM tblCNSTEngineersEstimateItem”
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = “spCNSTEstimateItemByEstimateIDSelect”
cmd.Parameters.AddWithValue(“@pEstimateID”, estimateid)
Dim data As DataSet = GetData(cmd)
Dim writer As New System.IO.StringWriter()
data.Tables(0).WriteXml(writer, XmlWriteMode.WriteSchema, False)
Return writer.ToString()
End Function
Private Shared Function GetData(cmd As SqlCommand) As DataSet
Using con As New SqlConnection(GetConnectionString(“ENGINEERSDevConnectionString”))
‘Using con As New SqlConnection(strConnString)
Using sda As New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using ds As New DataSet()
sda.Fill(ds)
Return ds
End Using
End Using
End Using
End FunctionOctober 30, 2013 at 3:19 pm in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31642Thanks Peter,
The data doesn’t appear to be encoded when I use it else where such as in elements. I wrapped the grid “parts” (source = …) in a GetItems function so I could call it after getting other data when the page loads or updated.
John
October 30, 2013 at 3:05 pm in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31639I added a cell select function and an alert statement to show me the row data. The row in the grid displayed “REMOVING DRAINAGE STRUCTURE”. however the alert statment displayed “REMOVING+DRAINAGE+STRUCTURE” so I’m guessing the data is being encoded when the data is loaded (from server or in grid) or the data is being encoded when used in functions like updaterow or cellselect?
October 30, 2013 at 2:24 pm in reply to: Decode text in updaterow function in grid Decode text in updaterow function in grid #31627Thanks Peter,
Then I am really confused as to what is going on. I add items to a grid by send the changes to SQL server through ajax call then reload the grid and the text looks fine. When I update any cell in a row, which is updated by the updaterow function the text is encoded. I have put in alter messaged in the update row function and it is coming from the grid encoded.Is there a way to insert an image?
here is text before updaterow: REMOVING DRAINAGE STRUCTURE
Text after updaterow: REMOVING+DRAINAGE+STRUCTURE
Text after I make an additional change: REMOVING%2BDRAINAGE%2BSTRUCTURE
As I said above, when I trap the text before it is wirtten to the server it is encoded. Any ideas? Is it how the data is loaded into the grid?
John
October 30, 2013 at 2:30 am in reply to: Grid aggregates not displaying Grid aggregates not displaying #31568Perfect! Thank you!
October 28, 2013 at 8:57 pm in reply to: Grid aggregates not displaying Grid aggregates not displaying #31488I’m pretty sure I am doing it the same way…but it doesn’t display at bottom of grid.
October 23, 2013 at 12:56 am in reply to: Update SQL data from grid using webservice Update SQL data from grid using webservice #31211I figured out what was wrong…the “data” wasn’t formatted correctly
here is updated function…
source =
{
datatype: “xml”,
updaterow: function (rowid, rowdata, commit) {
var rec = $.param(rowdata).split(“&”);
var estimateitemid = rec[0].split(“=”);
var itemnbr = rec[1].split(“=”);
var itemdesc = rec[2].split(“=”);
var itemunit = rec[3].split(“=”);
var itemqty = rec[4].split(“=”);
var itemprice = rec[5].split(“=”);
UpdateCNSTEngineersEstimateItem(estimateitemid[1], itemnbr[1], itemdesc[1], itemunit[1], itemqty[1], itemprice[1]);
commit(true);
},deleterow: function (rowid, commit) {
DeleteCNSTEngineersEstimateItem(rowid);
commit(true);
},datafields: [
{ name: ‘EstimateItemID’ },
{ name: ‘ItemNbr’ },
{ name: ‘ItemDescription’ },
{ name: ‘ItemUnit’ },
{ name: ‘ItemQuantity’ },
{ name: ‘ItemPrice’ }
],
async: false,
record: ‘Table’,
url: ‘CNSTWebService.asmx/GetCustomers’,
data: { estimateid: $(‘#cmbVersion’).children(“:selected”).attr(“id”) }
}; -
AuthorPosts