Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />
- <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxdata.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxscrollbar.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxmenu.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.selection.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.columnsresize.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxlistbox.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxdropdownlist.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.sort.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.filter.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxgrid.pager.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxnumberinput.js"></script>
- <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>
- <!-- <script type="text/javascript">
- $(document).ready(function () {
- //var data = generatedata(20);
- //var theme ='';
- //URL to the service
- url = "http://192.168.0.10/HTML5Service/loginservice.svc/getContacts",
- /*var source =
- {
- localdata: data,
- datatype: "array",
- updaterow: function (rowid, rowdata) {
- // synchronize with the server - send update command
- }
- }; */
- //Initializing the source property
- source = {
- datatype: "json",
- datafields: [
- { name: 'RespondentId' },
- { name: 'ParentRespondentId' },
- { name: '101' },
- { name: '102'},
- { name: '1'},
- { name: '1780'},
- { name: '1780_AnswerID'},
- { name: '1945'},
- { name: '1945_AnswerID'},
- { name: '17892'},
- { name: '17891'},
- { name: '17890'},
- { name: '1777'},
- { name: '3207'},
- { name: 'RecordRights'},
- { name: 'DeleteMsg'}
- ]
- };
- //Getting the source data with ajax GET request
- $.ajax({
- type: 'POST',
- dataType: 'json',
- async: false,
- url: 'http://192.168.0.10/HTML5Service/loginservice.svc/getContacts',
- cache: false,
- contentType: 'application/json; charset=utf-8',
- success: function (data) {
- alert(data.getContactsResult);
- //source.localdata = data.getContactsResult
- source.localdata = [{
- "RespondentId" : "5955651682765510056",
- "ParentRespondentId" : "0",
- "101" : " <a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=4619820559546108551'>SathianMaxId kannan </a> ",
- "102" : "1023",
- "1" : "14",
- "1780" : "17805",
- "1780_AnswerID" : "1780_AnswerID6",
- "1945" : "19457",
- "1945_AnswerID" : "1945_AnswerID8",
- "17892" : "178929",
- "17891" : "1789110",
- "17890" : "1789011",
- "1777" : "177712",
- "3207" : "320713",
- "RecordRights" : "RecordRights14",
- "DeleteMsg" : "DeleteMsg15"
- },{
- "RespondentId" : "4619820559546108551",
- "ParentRespondentId" : "0",
- "101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=4619820559546108551'>SathianMaxId kannan </a> ",
- "102" : "1023",
- "1" : "14",
- "1780" : "17805",
- "1780_AnswerID" : "1780_AnswerID6",
- "1945" : "19457",
- "1945_AnswerID" : "1945_AnswerID8",
- "17892" : "178929",
- "17891" : "1789110",
- "17890" : "1789011",
- "1777" : "177712",
- "3207" : "320713",
- "RecordRights" : "RecordRights14",
- "DeleteMsg" : "DeleteMsg15"
- }]
- },
- error: function (err) {
- alert("Error Call");
- }
- });
- // initialize the input fields.
- $("#firstName").addClass('jqx-input');
- $("#lastName").addClass('jqx-input');
- $("#contactType").addClass('jqx-input');
- $("#contactStatus").addClass('jqx-input');
- $("#Address").addClass('jqx-input');
- $("#Email").addClass('jqx-input');
- $("#firstName").width(150);
- $("#firstName").height(23);
- $("#lastName").width(150);
- $("#lastName").height(23);
- $("#contactType").width(150);
- $("#contactType").height(23);
- $("#contactStatus").width(150);
- $("#contactStatus").height(23);
- $("#Address").width(150);
- $("#Address").height(23);
- $("#Email").width(150);
- $("#Email").height(23);
- if (theme.length > 0) {
- $("#firstName").addClass('jqx-input-' + theme);
- $("#lastName").addClass('jqx-input-' + theme);
- $("#contactType").addClass('jqx-input-' + theme);
- $("#contactStatus").addClass('jqx-input-'+theme);
- $("#Address").addClass('jqx-input-'+theme);
- $("#Email").addClass('jqx-input-'+theme);
- }
- var dataAdapter = new $.jqx.dataAdapter(source);
- var editrow = -1;
- $("#jqxgrid").jqxGrid(
- {
- width: 300,
- source: dataAdapter,
- theme: theme,
- columnsresize: true,
- columns: [
- { text: 'RespondentId', datafield: 'RespondentId', width: 50 },
- { text: 'ParentRespondentId', datafield: 'ParentRespondentId', width: 50 },
- { text: 'Contact Type', datafield: '101', width: 50 }, //150
- { text: 'Contact Status',datafield:'102', width: 50}, //100
- { text: 'Address', datafield:'1', width:50}, //100
- { text: 'Email', datafield:'1780', width:100},
- { text: 'EmailAns', datafield:'1780_AnswerID', width:100},
- { text: 'ECont', datafield:'1945', width:100},
- { text: 'EContAns', datafield:'1945_AnswerID', width:100},
- { text: 'EAddr', datafield:'17892', width:100},
- { text: 'EConty', datafield:'17891', width:100},
- { text: 'EContys', datafield:'17890', width:100},
- { text: 'EFirst', datafield:'1777', width:100},
- { text: 'ELast', datafield:'3207', width:100},
- { text: 'ERights', datafield:'RecordRights', width:100},
- { text: 'EDelete', datafield:'DeleteMsg', width:100}
- ]
- });
- //Double Click
- var click = new Date();
- var lastClick = new Date();
- var lastRow = -1;
- $("#jqxgrid").bind('rowclick', function (event) {
- click = new Date();
- if (click - lastClick < 300) {
- if (lastRow == event.args.rowindex) {
- editrow = event.args.rowindex;
- var offset = $("#jqxgrid").offset();
- $("#popupWindow").jqxWindow({ position: { x: parseInt(offset.left) + 60, y: parseInt(offset.top) + 60} });
- var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
- $("#firstName").val(dataRecord.firstname);
- $("#lastName").val(dataRecord.lastname);
- $("#contactType").val(dataRecord.contactype);
- $("#contactStatus").val(dataRecord.contactstatus);
- $("#Address").val(dataRecord.address);
- $("#Email").val(dataRecord.email);
- $("#popupWindow").jqxWindow('show');
- // Initialize the popup window and buttons.
- $("#popupWindow").jqxWindow({ width: 250, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.01 });
- $("#Cancel").jqxButton({ theme: theme });
- $("#Save").jqxButton({ theme: theme });
- // Update the edited row when the user clicks the 'Save' button.
- $("#Save").click(function () {
- if (editrow >= 0) {
- var row = { firstname: $("#firstName").val(), lastname: $("#lastName").val(), contactype: $("#contactType").val(),contactstatus:$("#contactStatus").val(),address:$("#Address").val(),email:$("#Email").val()
- };
- $('#jqxgrid').jqxGrid('updaterow', editrow, row);
- $("#popupWindow").jqxWindow('hide');
- }
- });
- }
- }
- lastClick = new Date();
- lastRow = event.args.rowindex;
- });
- });
- </script> -->
- <script type="text/javascript">
- $(document).ready(function () {
- //URL to the service
- url = "http://192.168.0.10/HTML5Service/loginservice.svc/getContacts",
- //Initializing the source property
- source = {
- datatype: "json",
- datafields: [
- { name: 'RespondentId' },
- { name: 'ParentRespondentId' },
- { name: '101' },
- { name: '102'},
- { name: '1'},
- { name: '1780'},
- { name: '1780_AnswerID'},
- { name: '1945'},
- { name: '1945_AnswerID'},
- { name: '17892'},
- { name: '17891'},
- { name: '17890'},
- { name: '1777'},
- { name: '3207'},
- { name: 'RecordRights'},
- { name: 'DeleteMsg'}
- ]
- };
- //Filter option related code
- var addfilter = function () {
- var filtergroup = new $.jqx.filter();
- var filter_or_operator = 1;
- var filtervalue = '';
- var filtercondition = 'contains';
- var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
- filtervalue = '';
- filtercondition = 'starts_with';
- var filter2 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
- filtergroup.addfilter(filter_or_operator, filter1);
- filtergroup.addfilter(filter_or_operator, filter2);
- // add the filters.
- $("#jqxgrid").jqxGrid('addfilter', 'firstname', filtergroup);
- // apply the filters.
- $("#jqxgrid").jqxGrid('applyfilters');
- }
- //Getting the source data with ajax GET request
- var getValue;
- $.ajax({
- type: 'POST',
- dataType: 'json',
- async: false,
- url: 'http://192.168.0.10/HTML5Service/loginservice.svc/getContacts',
- data:'{}',
- cache: false,
- contentType: 'application/json; charset=utf-8',
- success: function (data) {
- alert(data.getContactsResult);
- source.localdata = data.getContactsResult;
- //source.localdata = [{"RespondentId" : "5955651682765510056","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=5955651682765510056'>SathianMaxHotmail kannan </a> ","102" : "SathianMaxHotmail kannan","1" : "Apr 16 2012 7:32PM","1780" : "","1780_AnswerID" : "","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "","17890" : "","1777" : "SathianMaxHotmail","3207" : "kannan","RecordRights" : "RecordRightsApr 16 2012 7:32PM","DeleteMsg" : "0"},{"RespondentId" : "4619820559546108551","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=4619820559546108551'>SathianMaxId kannan </a> ","102" : "SathianMaxId kannan","1" : "Apr 16 2012 7:31PM","1780" : "","1780_AnswerID" : "","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "","17890" : "","1777" : "SathianMaxId","3207" : "kannan","RecordRights" : "RecordRightsApr 16 2012 7:31PM","DeleteMsg" : "0"},{"RespondentId" : "60639102541Mar 12 2012 12:41PM885987","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=60639102541Mar 12 2012 12:41PM885987'>sathian kannan </a> ","102" : "sathian kannan","1" : "Mar 12 2012 12:41PM","1780" : "","1780_AnswerID" : "","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "","17890" : "","1777" : "sathian","3207" : "kannan","RecordRights" : "RecordRightsMar 12 2012 12:41PM","DeleteMsg" : "0"},{"RespondentId" : "825459377347Mar 9 2012 9:53PM45589","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=825459377347Mar 9 2012 9:53PM45589'>sathian kannan </a> ","102" : "sathian kannan","1" : "Mar 9 2012 9:53PM","1780" : "","1780_AnswerID" : "","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "","17890" : "","1777" : "sathian","3207" : "kannan","RecordRights" : "RecordRightsMar 9 2012 9:53PM","DeleteMsg" : "0"},{"RespondentId" : "7874697804115047011","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=7874697804115047011'> </a> ","102" : " ","1" : "Mar 1 2012 12:58PM","1780" : "","1780_AnswerID" : "","1945" : "","1945_AnswerID" : "","17892" : "","17891" : "","17890" : "","1777" : "","3207" : "","RecordRights" : "RecordRightsMar 1 2012 12:58PM","DeleteMsg" : "0"},{"RespondentId" : "6539358420877327893","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=6539358420877327893'>JV Test Contact </a> ","102" : "JV Test Contact","1" : "Mar 1 2012 11:43AM","1780" : "Homebuyer Lead","1780_AnswerID" : "3075","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "1414411114114411","17890" : "","1777" : "JV","3207" : "Test Contact","RecordRights" : "RecordRightsMar 1 2012 11:43AM","DeleteMsg" : "0"},{"RespondentId" : "7200153028676390640","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=7200153028676390640'>Velu`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,] Test Entry`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,] </a> ","102" : "Velu`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,] Test Entry`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,]","1" : "Mar 1 2012 9:27AM","1780" : "Homebuyer Lead","1780_AnswerID" : "3075","1945" : "Active","1945_AnswerID" : "3050","17892" : "","17891" : "","17890" : "","1777" : "Velu`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,]","3207" : "Test Entry`~!@#$%^&*(_+-=\|){;',./}[\;',./<>?/.,]","RecordRights" : "RecordRightsMar 1 2012 9:27AM","DeleteMsg" : "0"},{"RespondentId" : "8946029815556355766","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=8946029815556355766'>Singaravel _Quick Test </a> ","102" : "Singaravel _Quick Test","1" : "Mar 1 2012 9:17AM","1780" : "","1780_AnswerID" : "","1945" : "Active","1945_AnswerID" : "3050","17892" : "","17891" : "","17890" : "Test, velachery<br /> Novi, Michigan, 48377","1777" : "Singaravel","3207" : "_Quick Test","RecordRights" : "RecordRightsMar 1 2012 9:17AM","DeleteMsg" : "0"},{"RespondentId" : "6525484316388329804","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=6525484316388329804'>Test testTenantlname </a> ","102" : "Test testTenantlname","1" : "Feb 29 2012 12:52PM","1780" : "Tenant Lead","1780_AnswerID" : "3074","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected]","17891" : "","17890" : "","1777" : "Test","3207" : "testTenantlname","RecordRights" : "RecordRightsFeb 29 2012 12:52PM","DeleteMsg" : "0"},{"RespondentId" : "756Feb 28 2012 10:41AM58241291559843","ParentRespondentId" : "0","101" : "<a style=' cursor:Pointer;' href='Form_576_223_2.aspx?FormID=223&Mode=View&RespondentID=756Feb 28 2012 10:41AM58241291559843'>Test_ Contact 101 </a> ","102" : "Test_ Contact 101","1" : "Feb 28 2012 10:41AM","1780" : "Homebuyer Lead","1780_AnswerID" : "3075","1945" : "Active","1945_AnswerID" : "3050","17892" : "[email protected],[email protected]","17891" : "121212122121212","17890" : "tEST<br /> Troy, Michigan, 48083","1777" : "Test_","3207" : "Contact 101","RecordRights" : "RecordRightsFeb 28 2012 10:41AM","DeleteMsg" : "0"}]
- },
- error: function (err) {
- alert('Error');
- }
- });
- var editrow = -1;
- //Preparing the data for use
- var dataAdapter = new $.jqx.dataAdapter(source);
- $("#jqxgrid").jqxGrid({
- source: dataAdapter,
- //autowidth:true,
- width:300,
- height:300,
- sortable: true,
- pageable: true,
- filterable: true,
- ready: function () {
- addfilter();
- },
- autoshowfiltericon: true,
- theme: '',
- columns: [
- { text: 'RespondentId', datafield: 'RespondentId', width: 50 },
- { text: 'ParentRespondentId', datafield: 'ParentRespondentId', width: 50 },
- { text: 'Contact Type', datafield: '101', width: 50 },
- { text: 'Contact Status',datafield:'102', width: 50},
- { text: 'Address', datafield:'1', width:50},
- { text: 'Email', datafield:'1780', width:100},
- { text: 'EmailAns', datafield:'1780_AnswerID', width:100},
- { text: 'EConty', datafield:'17891', width:100},
- { text: 'EContys', datafield:'17890', width:100},
- { text: 'EFirst', datafield:'1777', width:100},
- { text: 'ELast', datafield:'3207', width:100}
- ]
- });
- //Double Click
- var click = new Date();
- var lastClick = new Date();
- var lastRow = -1;
- $("#jqxgrid").bind('rowclick', function (event) {
- click = new Date();
- if (click - lastClick < 300) {
- if (lastRow == event.args.rowindex) {
- editrow = event.args.rowindex;
- var offset = $("#jqxgrid").offset();
- $("#popupWindow").jqxWindow({ position: { x: parseInt(offset.left) + 60, y: parseInt(offset.top) + 60} });
- var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
- $("#firstName").val(dataRecord.firstname);
- $("#lastName").val(dataRecord.lastname);
- $("#contactType").val(dataRecord.contactype);
- $("#contactStatus").val(dataRecord.contactstatus);
- $("#Address").val(dataRecord.address);
- $("#Email").val(dataRecord.email);
- $("#popupWindow").jqxWindow('show');
- // Initialize the popup window and buttons.
- $("#popupWindow").jqxWindow({ width: 250, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.01 });
- $("#Cancel").jqxButton({ theme: theme });
- $("#Save").jqxButton({ theme: theme });
- // Update the edited row when the user clicks the 'Save' button.
- $("#Save").click(function () {
- if (editrow >= 0) {
- var row = { firstname: $("#RespondentId").val(), lastname: $("#ParentRespondentId").val(), contactype: $("#contactType").val(),contactstatus:$("#contactStatus").val(),address:$("#Address").val(),email:$("#Email").val()
- };
- $('#jqxgrid').jqxGrid('updaterow', editrow, row);
- $("#popupWindow").jqxWindow('hide');
- }
- });
- }
- }
- lastClick = new Date();
- lastRow = event.args.rowindex;
- });
- //Filter options
- $('#events').jqxPanel({ width: 300, height: 80, theme: theme });
- $("#jqxgrid").bind("filter", function (event) {
- $("#events").jqxPanel('clearcontent');
- var filterinfo = $("#jqxgrid").jqxGrid('getfilterinformation');
- var eventData = "Triggered 'filter' event";
- for (i = 0; i < filterinfo.length; i++) {
- var eventData = "Filter Column: " + filterinfo[i].filtercolumntext;
- $('#events').jqxPanel('prepend', '<div style="margin-top: 5px;">' + eventData + '</div>');
- }
- });
- $('#clearfilteringbutton').jqxButton({ height: 25, theme: theme });
- $('#filterbackground').jqxCheckBox({ checked: true, height: 25, theme: theme });
- $('#filtericons').jqxCheckBox({ checked: false, height: 25, theme: theme });
- // show/hide filter background
- $('#filterbackground').bind('change', function (event) {
- $("#jqxgrid").jqxGrid({ showfiltercolumnbackground: event.args.checked });
- });
- // show/hide filter icons
- $('#filtericons').bind('change', function (event) {
- $("#jqxgrid").jqxGrid({ autoshowfiltericon: !event.args.checked });
- });
- });
- </script>
- </head>
- <body class='default'>
- <div id="loadData" style="width:500px; height:100%; scroll:auto"> </div>
- <div id='jqxWidget'>
- <div id="jqxgrid"></div>
- <!-- Pop up Window Code Starts -->
- <div style="margin-top: 50px;">
- <div id="cellbegineditevent"></div>
- <div style="margin-top: 10px;" id="cellendeditevent"></div>
- </div>
- <div id="popupWindow">
- <div>Edit</div>
- <div style="overflow: hidden;">
- <table>
- <tr>
- <td align="right">First Name:</td>
- <td align="left"><input id="firstName" /></td>
- </tr>
- <tr>
- <td align="right">Last Name:</td>
- <td align="left"><input id="lastName" /></td>
- </tr>
- <tr>
- <td align="right">Contact Type:</td>
- <td align="left"><input id="contactType" /></td>
- </tr>
- <tr>
- <td align="right">Contact Status:</td>
- <td align="left"><input id="contactStatus" /></td>
- </tr>
- <tr>
- <td align="right">Address:</td>
- <td align="left"><input id="Address" /></td>
- </tr>
- <tr>
- <td align="right">Email:</td>
- <td align="left"><input id="Email" /></td>
- </tr>
- <tr>
- <td align="right"></td>
- <td style="padding-top: 10px;" align="right"><input style="margin-right: 5px;" type="button" id="Save" value="Save" /><input id="Cancel" type="button" value="Cancel" /></td>
- </tr>
- </table>
- </div>
- </div>
- <!-- Pop up Window Code Ends -->
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement