jQWidgets Forums
Forum Replies Created
-
Author
-
Histro… You mention .DataBind() but you did not include it in the demo and your API documentation for the grid does not have this method. Where EXACTLY does it go?
OK,… I have more than one grid on this page. I need to update all grids either at once or in sequence. Each grid uses an ajax API call. After the grids are updated, the script selects the newly created account. My issue is the grid updates. is there a way to do this with out going to ES7 async/await functions?
July 8, 2016 at 8:46 pm in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85622I have found a work around until a function is developed:
function GetRowIDOfItemByGUID(GridName, GuidID, DataField)
{
var _Object = $(“#” + GridName);
var dataInformation = $(_Object).jqxGrid(‘getdatainformation’);
for (i = 0; i < dataInformation.rowscount; i++)
{
if($(_Object).jqxGrid(‘getcellvalue’, i, DataField) == GuidID)
{
return i;
}
}
return null;
}and from the main page (this is in razor syntax):
var rowIndex = GetRowIDOfItemByGUID(“jqxDefaultDiscountAccountDropdownGrid”, @Html.Raw(string.Format(“\”{0}\””, PayingBills_DefaultDiscountAccount.ToString())), “AccountIndex”);
$(“#jqxDefaultDiscountAccountDropdownGrid”).jqxGrid(‘selectrow’, rowIndex);July 8, 2016 at 11:30 am in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85618One last thing…. These are GUIDs not INT32 so how do I select a row if the rowid is unknown?
July 8, 2016 at 10:59 am in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85617OK,… I just realized that my grid name is not the one supplied in the previous posting. I changed the id to the correct id and now Im getting an error stating: Cannot read property ‘{prop}’ of undefined. I also just realized that I have a set reusable functions for my grids and in one of those functions, I have a bound setting for the selectrow event. Unfortunately, the script is not able to work because the “Object” name is not being passed to the sub function.
July 8, 2016 at 10:38 am in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85615This is what I have so far:
var rowIndex = $("#jqxDefaultDiscountAccountDropdownWidget").jqxGrid('getrowboundindexbyid', @Html.Raw(string.Format("\"{0}\"", PayingBills_DefaultDiscountAccount.ToString())));
$(“#jqxDefaultDiscountAccountDropdownWidget”).jqxGrid(‘selectrow’, rowIndex);
which translates to the following at render time:
var rowIndex = $("#jqxDefaultDiscountAccountDropdownWidget").jqxGrid('getrowboundindexbyid', "7c98652e-7941-e611-9c47-c86000a214e4");
$(“#jqxDefaultDiscountAccountDropdownWidget”).jqxGrid(‘selectrow’, rowIndex);
July 8, 2016 at 10:22 am in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85614OK,… I think this is a start, however, I do not believe that my grid has a bound index. How do I set this?
July 8, 2016 at 6:26 am in reply to: Dynamically set the value of the Grid Dynamically set the value of the Grid #85609Currently, all the data in the list is unique by its ID which is a GUID. I need to be able to select the row where the GUID is a certain value.
July 6, 2015 at 6:48 pm in reply to: Cleaner method of SelectedRowIndexes? Cleaner method of SelectedRowIndexes? #73418this example should bear results
http://www.jqwidgets.com/community/topic/get-selected-row-data/June 29, 2015 at 10:51 pm in reply to: how would I differentiate between a row that has data and one that doesn't? how would I differentiate between a row that has data and one that doesn't? #73166found the answer, all I need to do is check to see if the AddItem column is undefined and that did the trick:
if($.type(row.UOMRelatedUnit_AddItem) !== "undefined")
@ivailo, Ive got a working grid with checkboxes, however I can only select two checkboxes when there are 10 rows. What am I doing wrong?
function UOMCountEachMulticolumn(){ // Start Multicolumn for Unit Of Measure for Count -> Each // prepare the data var GenerateUOMCountEachMulticolumnRow = function (i) { var newRow = {}; newRow["UOMCountEachIndex"] = ''; newRow["UOMCountEachAddItem"] = F; newRow["UOMCountEachName"] = ''; newRow["UOMCountEachAbbreviation"] = ''; newRow["UOMCountEachConversion"] = ''; return row; } var data = new Array(); var jqxUOMCountEachIndex = [""]; var jqxUOMCountEachName = [""]; var jqxUOMCountEachAbbreviation = [""]; var jqxUOMCountEachConversion = [""]; var jqxUOMCountEachAddItem = F; if(@(Html.Raw(JsonConvert.SerializeObject(ViewBag.jqxUOMCountEachIndex))) !== null){ var jqxUOMCountEachIndex = [@(Html.Raw(JsonConvert.SerializeObject(ViewBag.jqxUOMCountEachIndex)))]; var jqxUOMCountEachName = [@(Html.Raw(JsonConvert.SerializeObject(ViewBag.jqxUOMCountEachName)))]; var jqxUOMCountEachAbbreviation = [@(Html.Raw(JsonConvert.SerializeObject(ViewBag.jqxUOMCountEachAbbreviation)))]; var jqxUOMCountEachConversion = [@(Html.Raw(JsonConvert.SerializeObject(ViewBag.jqxUOMCountEachConversion)))]; }; for (var i = 0; i < jqxUOMCountEachIndex.length; i++) { var row = {}; row["UOMCountEachIndex"] = jqxUOMCountEachIndex[i]; row["UOMCountEachAddItem"] = jqxUOMCountEachAddItem[i] row["UOMCountEachName"] = jqxUOMCountEachName[i]; row["UOMCountEachAbbreviation"] = jqxUOMCountEachAbbreviation[i]; row["UOMCountEachConversion"] = jqxUOMCountEachConversion[i]; data[i] = row; } var source = { localdata: data, datatype: "local", datafields: [ { name: 'UOMCountEachIndex', type: 'string' }, { name: 'UOMCountEachAddItem', type: 'string' }, { name: 'UOMCountEachName', type: 'string' }, { name: 'UOMCountEachAbbreviation', type: 'string' }, { name: 'UOMCountEachConversion', type: 'number' } ], addrow: function (rowid, rowdata, position, commit) { commit(T); }, updaterow: function (rowid, newdata, commit) { commit(T); } }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxUOMCountEachDropdownGrid").jqxGrid({ width: 500, height: 200, source: dataAdapter, editable: T, selectionmode: 'row', theme: 'energyblue', showtoolbar: T, rendertoolbar: function (toolbar) { var me = this; var container = $("<div style='margin: 5px;'></div>"); toolbar.append(container); container.append('<input id="addrowbutton" type="button" value="Add New Row" />'); container.append('<input style="margin-left: 5px;" id="addmultiplerowsbutton" type="button" value="Add Multiple New Rows" />'); $("#addrowbutton").jqxButton(); $("#addmultiplerowsbutton").jqxButton(); // create new row. $("#addrowbutton").on('click', function () { $("#jqxUOMCountEachDropdownGrid").jqxGrid('beginupdate'); var datarow = GenerateUOMCountEachMulticolumnRow(); var commit = $("#jqxUOMCountEachDropdownGrid").jqxGrid('addrow', null, datarow); $("#jqxUOMCountEachDropdownGrid").jqxGrid('endupdate'); }); // create new rows. $("#addmultiplerowsbutton").on('click', function () { $("#jqxUOMCountEachDropdownGrid").jqxGrid('beginupdate'); for (var i = 0; i < 10; i++) { var datarow = GenerateUOMCountEachMulticolumnRow(); var commit = $("#jqxUOMCountEachDropdownGrid").jqxGrid('addrow', null, datarow); } $("#jqxUOMCountEachDropdownGrid").jqxGrid('endupdate'); }); }, columns: [ { text: '', editable: F, datafield: 'UOMCountEachIndex', width: 0 }, { text: 'Add', datafield: 'UOMCountEachAddItem', columntype: 'checkbox', width: 40 }, { text: 'Name', editable: T, datafield: 'UOMCountEachName', columntype: 'textbox', width: 200 }, { text: 'Abbreviation', editable: T, datafield: 'UOMCountEachAbbreviation', columntype: 'textbox', width: 100 }, { text: '# of EA', editable: T, datafield: 'UOMCountEachConversion', columntype: 'textbox', width: 100 } ] }); $("#jqxUOMCountEachDropdownGrid").bind('cellendedit', function (event) { if (event.args.value){ $("#jqxUOMCountEachDropdownGrid").jqxGrid('selectrow', event.args.rowindex); } else { $("#jqxUOMCountEachDropdownGrid").jqxGrid('unselectrow', event.args.rowindex); } }); // select or unselect rows when the checkbox is checked or unchecked. $("#jqxUOMCountEachDropdownGrid").bind('cellendedit', function (event) { if (event.args.value) { $("#jqxUOMCountEachDropdownGrid").jqxGrid('selectrow', event.args.rowindex); } else { $("#jqxUOMCountEachDropdownGrid").jqxGrid('unselectrow', event.args.rowindex); } }); //End Multicolumn for Sales Accounts }
thnak you
-
AuthorPosts