Hello, I want to know how is data source updated after grid is updated with new data.
Here's my app
$.ig.loader({ scriptPath: './javascript_common/igniteui/corefiles/js/', cssPath: './javascript_common/igniteui/corefiles/css/', theme: 'metro'});$.ig.loader("igGrid.Responsive.Hiding.Paging.Updating", function () { $("#grid1").igGrid({ dataSource: 'http://192.168.1.222/safestyle-windows.co.uk/admin-new/users.php?mode=getUsers', responseDataKey: "results", primaryKey: 'id', autoGenerateColumns: false, autoGenerateLayouts: false, columns: [{ key: 'id', dataType: 'number', headerText: 'Id', }, { key: 'fullname', dataType: 'string', headerText: 'Full Name' }, { key: 'fname', dataType: 'string', headerText: 'First name' }, { key: 'lname', dataType: 'string', headerText: 'Last Name' }, { key: 'username', dataType: 'string', headerText: 'User Name' }, { key: 'userLevel', dataType: 'string', headerText: 'User Level' }, { key: 'userGroupId', dataType: 'string', headerText: 'User Group' }, { key: 'email', dataType: 'string', headerText: 'Email' }, { key: 'status', dataType: 'bool', headerText: 'Status' }], features: [ { name: "Paging", type: "remote", pageSize: 2, // Default number of records per page. recordCountKey : 'totalCount', // The property in the response that will hold the total number of records in the data source. pageSizeUrlKey : 'psize', // Denotes the name of the encoded URL parameter that will state what is the currently requested page size. pageSizeList : [1,2,3,4,5,6,7,8,9,10,20,30], // Default: [5, 10, 20, 25, 50, 75, 100]. contents of the page size dropdown indicating what preconfigured page sizes are available to the end user. pageIndexUrlKey : 'page', // Denotes the name of the encoded URL parameter that will state what is the currently requested page index. },{ name: 'Responsive', forceResponsiveGridWidth: false, columnSettings: [{ columnKey: 'id', classes: "ui-hidden-phone" }, { columnKey: 'fullname', classes: "ui-visible-phone", configuration: { phone: { template: "<span>${lname}, ${fname}</span>" } } }, { columnKey: 'fname', classes: "ui-hidden-phone" }, { columnKey: 'lname', classes: "ui-hidden-phone" }] }, { name: 'Hiding', hiddenColumnIndicatorHeaderWidth: 14, columnSettings: [{ //hide unbound from chooser list and indicator columnKey: 'fullname', allowHiding: false }] }, { name: "Updating", enableAddRow: true, showReadonlyEditors: false, dataDirty: function (evt, ui) { return false; }, rowEditDialogOpening: function (event, ui) { if ($(ui.owner.element).igGridResponsive("getCurrentResponsiveMode") != "desktop") { ui.owner.options.rowEditDialogWidth = document.body.clientWidth * 0.9; ui.dialogElement.children('.ui-dialog-content').css('height',ui.owner.grid.element.height() - 115); ui.owner.options.rowEditDialogHeight = ui.owner.grid.element.height(); } var columns = ui.owner.grid.options.columns; for (i = 0; i < columns.length; ++i) { //use 0 instead of false to be able to differentiate when restoring state if (columns[i].hidden) columns[i].hidden = 0; } }, rowEditDialogOpened: function (event, ui) { var columns = ui.owner.grid.options.columns; for (i = 0; i < columns.length; ++i) { if (columns[i].hidden === 0) columns[i].hidden = true; } }, editMode: "rowedittemplate", columnSettings: [{ columnKey: 'fullname', readOnly: true }, { columnKey: 'id', readOnly: true }, { columnKey: "email", validatorOptions: { required: true, errorMessage: "Enter a valid email.", bodyAsParent: false } }] }] });});var grid = $('#grid1'); grid.bind("iggridupdatingrowdeleting", function (e, args) { var result = confirm("Sure to delete ?"); if (result==true) { $.ajax({ type: "POST", url: "users.php?mode=deleteUser", data: { id: args.rowID } }).done(function( msg ) { // alert( "Deleted: " + args.rowID ); }); }else{ return false; } });
Anybody knows how to do this? Its a grid when u click on a row, a new popup comes up with rowdata fields you can change. After clicking "done" how do i post these new data fileds info and update mysql db?
Hello Shiva,
Thank you for contacting Infragistics!
For updating the Ignite UI Grid please see the following documentation: http://help.infragistics.com/NetAdvantage/jQuery/2013.1/CLR4.0?page=igGrid_Updating.html
Pleas also look into the commit and saveChanges methods of the grid: http://help.infragistics.com/jQuery/2013.1/ui.iggrid
Please let me know if you have any further questions concerning this matter.
Sincerely, Mike P. Developer Support Engineer II Infragistics, Inc. www.infragistics.com
Hello Mike,
Thank you for the info. As you can see I have to update the datasource once data is changed in the grid. Which javascript event would help me do this? I have data in mysql table and once data is retrieved from table using PHP script, how do i update data if there are any changes. My row editing feature is got from Updating feature in js using rowedittemplate as editMode.
Thank you for the update. To update your php script datebase you will want handle an updating event of the grid and then send that data to your database. Or if your database has a url for updating you can set the updateUrl you can find more information by going to the following link and clicking the Options tab and scrolling down to updateUrl:
http://help.infragistics.com/jQuery/2013.1/ui.iggrid
When I add the property updateUrl to the grid, this doesn't trigger a submission to the given URL in JavaScript, once data is edited in grid. Also, strangely the delete event is being called twice and shows the confirmation alert box twice:
updateUrl
Thank you for the update. I have a follow up question concerning this matter. What are you setting at the updateUrl? Are you calling saveChanges or commit anywhere?
I am following up to see if this matter has been resolved. If this isn’t the case please answer the following questions:
What are you setting at the updateUrl? Are you calling saveChanges or commit anywhere?
Please let me know if I may be of further assistance with this matter.
i am using infragistics jquery grid 2013 version where i am facing problem in data populated in the grid. Please find the example of json object mentioned below
Object { Id="5225e9e351d8d61f78697188", Date="2013-09-03 15:53:39.5522", Message="messeage Service for '<Query>ajax'"}
Everything works fine but in the grid for message column it get populated and cell has a value as "messeage Service for 'ajax'" instead of showing the full message as "messeage Service for '<Query>ajax'".
"<Query>" is getting excluded from data rest is binding to the grid cell.
I already spend a day on this but not able to resolve it. Please help me its urgent.
Thanks in advance....