Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

records status is not update to modified. Issue refrance #1552 #1555

Closed
ImAbhishekTomar opened this issue Mar 27, 2017 · 21 comments
Closed

records status is not update to modified. Issue refrance #1552 #1555

ImAbhishekTomar opened this issue Mar 27, 2017 · 21 comments

Comments

@ImAbhishekTomar
Copy link

thanks - @mpf82 for resolved this issue : Set object is not update all records #1552
But this is not resolved completely description below

** records status is not update to modified.**

This code is not fill data in changes object so my changes object is display empty.

var updatedRows=w2ui['gridIABU'].changes;

this red mark
image

but this is showing blank....

all record selected but red mark identifier is not showing on records

@spizzi77
Copy link

Hi,
But it's .changes a valid method?
I use getChanges

http://w2ui.com/web/docs/1.5/w2grid.getChanges

@ImAbhishekTomar
Copy link
Author

@spizzi77 .getChanges Not Working........ I am already tried both method.

@mpf82 Please help - this is urgent for me this issue in production based application.

@ImAbhishekTomar
Copy link
Author

ImAbhishekTomar commented Mar 28, 2017

Issue detail - if you are update any record manually then record add "w2ui-changed" this class for showing updated records and showing Red mark . But in my select all code this class not added this is a problem. and I am try to getting change record this is not working -

This is a Red Mark - not showing if I am check my all records

any other way to update record status by code and by forced

this red mark
image

My select all code is provided by #1552 @mpf82

set: function (recid, record, noRefresh) { // does not delete existing, but overrides on top of it if ((typeof recid == 'object') && (recid !== null)) { noRefresh = record; record = recid; recid = null; } // update all records if (recid == null) { for (var i = 0; i < this.records.length; i++) { $.extend(true, this.records[i], record); // recid is the whole record } if (noRefresh !== true) this.refresh(); }

@spizzi77
Copy link

Hy jackryu,
Well, i think here we have two problems, if i understand well you have a columns with checkbox, but this checkbox column isn't the multiselect of the object but it's a column that YOU created with checkbox, is it right?Did you want that when the user check this checkbox you want display the w2ui-cahnged class?
Because this is one problem, the other problem is that the .changes isn't a valid method and you must use the .getChanges.
Well you can see on my site under the menu "esempiW2ui"->Ex.ple W2Grid 1.5.1 ONLY onSelect that
the edit column(Citta Residenza) it's working well.

https://fractalcosmo.com/MvcWebLog/paginaDefault.php

You can do a multiselect untill 5 records(this is wanted by me) and when you click "variazione residenza" you can see in console browser that the array final is corrected.There is only a bug in w2ui 1.5.1 using both onSelect that onClick, because there are not working together with multiselect, it's an issue that i opened days ago.
But the edit seems work fine.
Your problem it's that you want to display w2ui-changed also only checking the checkbox?
But you must this on the onClick checkbox and force the w2ui-changed css, for sure because you are not editing a checkbox.
If i understand well the problem.
The other problem is that if you use onClick and onSelect events together after you will not able to do a multiselect, this is a bug, hope this will be fixed soon, you can see this in my examples w2Grid 1.5.1 onClick OnSelect not working instead w2Grid 1.4.3 onClick onSelect it's working well.
So where is the problem?Only insert the w2ui-changed when you click your column of checkboxes?You can do this but you must do at every click of the checkbox.
In next days i can try to add a column checkbox in that grid and try to resolve it for you, if this is the problem.
Bye
Andrea

@ImAbhishekTomar
Copy link
Author

I am try to explain again --

Snapshot
w2uigrid

Issue

if i am select all checkbox (Column : Include [2]) using Button (Select (1)) this button select all check box. code in select all button Ref : Code 0.1

But my save button (3) not enable if i am try to enable this button by forced then i am not getting any thing in getChainge object code in Save button (0.2).

I am Try Changes and getChanges both function.

Code 0.1 :

set: function (recid, record, noRefresh) { // does not delete existing, but overrides on top of it if ((typeof recid == 'object') && (recid !== null)) { noRefresh = record; record = recid; recid = null; } // update all records if (recid == null) { for (var i = 0; i < this.records.length; i++) { $.extend(true, this.records[i], record); // recid is the whole record } if (noRefresh !== true) this.refresh(); }

this code suggest in - #1552 this issue by @mpf82

Code 0.2 :

  onSave: function (event) { var $BinsChangesJOSN = JSON.stringify(event.getChanges); }

@spizzi77
Copy link

spizzi77 commented Mar 29, 2017

Here's a little of confusion, you asked the reason because the red triangle of w2ui-changed class is not showing in your include column;
That triangle is showing when a user do an Edit Field, instead clicking the select button and check all the checkbox is not an edit field event so it's normal that the triangle red wui-changed is not showing, if you want to able the save button when you click the "select" button, this is another problem, and you must able the button on the onClick event of the "Select" button and write

$('#tb_'+nameGrid+'_toolbar_item_w2ui-save').removeClass('disabled');

But an arrow at your side it's that really this seems a bug because also in the w2ui demo the save button is not able....Like as in this example:

http://w2ui.com/web/demos/#!grid/grid-17

You can force the removeClass disabled but also if you force the removeClass disable seems that there is not attached the event so you can't click the save button;
Btw i always use custom buttons to save i don't use the onSave event so i didn't see this.
I suggest to put a button in your toolbar and not use the save event untill this bug it isn't fixed.

Ciao
Andrea

Ps:So another way to do what you want it's create a custom save button in the toolbar, able and disabled with your own, on the onClick of the save custom button you do a loop of each records and get the parameters that you need to send at the server put all in array and send this array at the server.Simple, a more comfortable way it's give a class in the html render function of the include column in this way to check all and do the loop it's more comfortable, or you do a loop $(records).each(funtion(){}), yes you must detect if there was a check all or a simple multiselect of that checkbox....This is the work.
Ciao

@ImAbhishekTomar
Copy link
Author

ImAbhishekTomar commented Mar 29, 2017

thanks for support but getChanges object is still empty so how can i find selected or updated records ?
this is my major problem any other way to fill data in getChanges object time of selection all checkbox.

@spizzi77
Copy link

spizzi77 commented Mar 29, 2017

I done a little variation at the grid that you see on my site:

https://fractalcosmo.com/MvcWebLog/esempiW2ui.php?versione151OnlyOnSelect

I attach you the code of the all javascript of all the grid, but using two checkbox column means do more work, do you know, because you must control everything.
Now a quickly logic it's this:

Create a button, in this case i named Get Selection Check, a quickly idea it's do two loops, one to get all the records and one to get the recid of checked, you can see i named the column CHECK, in the function
getSelectedCheck you get all the records and all the checkbox id checked after inside the records loop you get that recid selected from the loop of the checked and push in array all the value....I done only half work you need to do other half.
The first console.log are the recid checked after you must use these recid checked and if recid of checked is equal to recid of records you get the values and push them in an array.
At the end you will have the array to send to the server....
Ciao
Here you go:

	<div id="risultatiVerione151">
		<div class="spacer10"> </div>
		<div class="containerBorderBlank" id="panelRisultatiVersione151">
			<div id="gridVersione151" style="width:100%;height:100%"> </div>
		</div>
	</div><br>
$(document).ready(function(){	
	
	timestamp = new Date().getTime();
	//Sempre la destroy altrimenti va in errore di name già definito se viene chiusa e riaperta
	$().w2destroy('gridVersione151');
	//E lo show del div della griglia
	$('#gridVersione151').show();

	//un css di default
    $('#gridVersione151').css({ width: '100%' }).animate({ height: '100%' }, 100);
	$('#gridVersione151').w2grid({
        name: 'gridVersione151',
        header : '<div class=""><b>Esempio Dati w2ui Versione 1.5.rc1</b></div>',
        multiSelect : true,
        fixedBody : false,
        msgNotJSON: '<div style="text-align:center"><b>Non ci sono validi risultati</b></div>',
        show: {
            header       : true,
            toolbar      : true,
            footer       : false,
            lineNumbers  : false,
            selectColumn : true,
            expandColumn : false,
            toolbarColumns : false,
	        toolbarSearch : true,
			toolbarReload : false,
        },
        toolbar : {items:[
	              { type: 'button',  id: 'itemVariazione',  caption: 'Variazione Residenza', icon: 'glyphicon glyphicon-edit', hint: 'Variazione Residenza' },
	              { type: 'button',  id: 'itemGetRecordSelected',  caption: 'Get Selection Check', icon: 'glyphicon glyphicon-edit', hint: 'Get Selection on Check column' },
	        ],
	        onClick: function (event) {
	        	if (event.target == 'itemVariazione'){
	        		variazioneDatoResidenza(arrayValori);
	        	}
	        	if (event.target == 'itemGetRecordSelected'){
	        		getSelectedCheck();
	        	}
	        },	            
	    },  
        columns: [               
            { field: 'nome', caption: '<div style="text-align: center;">Nome<div>', sortable:true,size:'10%',attr: 'align=center' },
            { field: 'cognome', caption: '<div style="text-align: center;">Cognome<div>',sortable:true,size:'10%',attr: 'align=center'},
            { field: 'dataNascita', caption: '<div style="text-align: center;">Data Nascita<div>',size:'8%',sortable:true,attr: 'align=center'},
            { field: 'cittaResidenza', caption: '<div style="text-align: center;">Città Residenza*Double click to edit*<div>', sortable:true,size:'20%',editable: { type: 'text',style: 'background-color: #ffcccc' } },
            { field: 'input', caption: '<div style="text-align: center;">Check<div>', sortable:false,size:'20%',render:function(record){
            	return "<div style='text-align:center'><input type='checkbox' name='checkGrid' class='checkGrid' value='"+record.recid+"'></div>";
            } },
        ],
        searches: [
            { type: 'text', field: 'nome', caption: 'Nome',operator:'contains' },
            { type: 'text', field: 'cognome', caption: 'Cognome',operator:'contains' },
            { type: 'text', field: 'dataNascita', caption: 'Data Nascita',operator:'contains' },
            { type: 'text', field: 'cittaResidenza', caption: 'Città Residenza',operator:'contains' },
	    ],
        onChange: function(event){
        	event.onComplete = function(event) {
        		$(window).click(function(event){
					$('.w2ui-changed').each(function(event){
					  	$('.w2ui-changed').css('color','red');
					});
        		});	
        	};
        },
        onRefresh:function(event){
        	event.onComplete=function(event){
        		$('#grid_gridVersione151_check_all').hide();
        		//Inseriamo un title sulla input ricerca
        		$('#grid_gridElencoToDo_search_all').attr('title','Tutte le colonne sono ordinabili e ridimensionabili');
        		records = this.records;
        		colonne = this.columns;
    			totaleRisultati = this.totaleRisultati;
				console.log(totaleRisultati);
        		//Inseriamo l'icona di sort al refresh ready della tabella per dare un feedback all'operatore
        		$(colonne).each(function(event){
        			$("td:contains('Nome')").find($('.w2ui-col-header > div')).eq(0).addClass('w2ui-sort-up');
        			$("td:contains('Cognome')").find($('.w2ui-col-header > div')).eq(0).addClass('w2ui-sort-up');
        			$("td:contains('Data')").find($('.w2ui-col-header > div')).eq(0).addClass('w2ui-sort-up');
        			$("td:contains('Residenza')").find($('.w2ui-col-header > div')).eq(0).addClass('w2ui-sort-up');
        		});        		
        		
        	};
        },
        onLoad:function(event){

			var response = [];
			var responseText = (event.xhr.responseText);
			//console.log(responseText);
			response = responseText.match(/{.*(.*)\}/);
			
			if (response != null){
				var finale = response[0];
				var arrayFinale = JSON.parse(finale);
				var nazione = arrayFinale.nazione;
				var nazionalita = arrayFinale.nazionalita;
    			var totaleRisultati = arrayFinale.totaleRisultati;
				console.log(totaleRisultati);
				console.log(nazione);
				console.log(nazionalita);
				var records = arrayFinale.records;
				$(records).each(function(event){

				});
			}    	
        },
        onEditField:function(event){
        	//console.log(event);
        	//console.log(this);
        	event.onComplete=function(event){
        		//console.log(this);
        		//console.log(event);
        		id = event.recid;
				$('#grid_gridVersione151_edit_'+id+'_3').keypress(function(event){
					 return noNumeri(event);
				});
				$('#grid_gridVersione151_edit_'+id+'_3').blur(function(event){
						stringa = this.value;
						repStringa = (stringa.replace(/[^a-zA-Z ]/g, ""));
						$('#grid_gridVersione151_edit_'+id+'_3').val(repStringa);				
				});
        	};
    		$('.w2ui-changed').each(function(event){
			  	$(this).css('color','red');
			});
        },
        onSelect : function (event){	
        	target = event.target;
			//Oltre i 5 record selezionati blocchiamo con un unselect la possibilità di selezionare altri record
			$.fn.bloccaSelezione = function(event){
				var record = event.recid;	        		
        		w2ui['gridVersione151'].unselect(record);
			};
			
        	event.onComplete = function(event) {
        	   //La getSelection ritorna le checkbox selezionate
		       sel = this.getSelection();
		       //console.log('this get selection ' +sel);
		       arrayValori = [];

		       if (sel.length == 0){
					w2ui['gridVersione151'].toolbar.disable('itemVariazione');
		       }
			   else{
					w2ui['gridVersione151'].toolbar.enable('itemVariazione');			   	
			   }
			   
		       if (sel.length > 5){
				  $(this).bloccaSelezione(event);
				  return;
		       }			   
			   
	           target = w2ui[target];
		       //Al select delle checkbox inseriamo in un array chiave valore tutti i record 
		       for (i=0; i < sel.length;i++){
		       	  //console.log(w2ui[target]);
		          recidRecord = sel[i];
		          //console.log('recid record :'+recidRecord);	
		          records = target.records;
		          //console.log(records);
		          $(records).each(function(){
		          	recidTarget = this.recid;
	          		if (recidTarget == recidRecord){	
		          		 //console.log(this);        	
						 recid = $.trim(this.recid);
						 id = $.trim(this.id);	
						 nome= $.trim(this.nome);
						 cognome = $.trim(this.cognome);
						 dataNascita = $.trim(this.dataNascita);
						 cittaResidenza = $.trim(this.cittaResidenza);
						 arrayValori.push({recid:recid,id:id,nome:nome,cognome:cognome,dataNascita:dataNascita,cittaResidenza:cittaResidenza});	
	          		}
		          });
		       }
		    }; 	
    	},
        onUnselect : function(event){
			target=event.target;
			event.onComplete = function(event) {
			    sel = this.getSelection();
			   	arrayValori = [];
		        if (sel.length == 0){
					w2ui['gridVersione151'].toolbar.disable('itemVariazione');
		        }
			    else{
					w2ui['gridVersione151'].toolbar.enable('itemVariazione');	   	
			    }
	           target = w2ui[target];
		       //Sull'Unselect dobbiamo aggiornare l'array 
		       for (i=0; i < sel.length;i++){
		       	  //console.log(w2ui[target]);
		          recidRecord = sel[i];
		          //console.log('recid record :'+recidRecord);	
		          records = target.records;
		          //console.log(records);
		          $(records).each(function(){
		          	recidTarget = this.recid;
	          		if (recidTarget == recidRecord){	
		          		 //console.log(this);        	
						 recid = $.trim(this.recid);
						 id = $.trim(this.id);	
						 nome= $.trim(this.nome);
						 cognome = $.trim(this.cognome);
						 dataNascita = $.trim(this.dataNascita);
						 cittaResidenza = $.trim(this.cittaResidenza);
						 arrayValori.push({recid:recid,id:id,nome:nome,cognome:cognome,dataNascita:dataNascita,cittaResidenza:cittaResidenza});	
	          		}
		          });
		       }
			};     	
    	},
    	onClick:function(event){
    		//event.preventDefault();	
        	/*event.onComplete = function(event) {
	    		id = event.recid;
	    		//console.log(id);
	       		$('#grid_gridVersione151_rec_'+id).find('td').eq(4).click();				
        	};*/    		
    	},
		onError:function(event){
			event.preventDefault();
			numeroErrore = event.message.errore;
			if (numeroErrore == '99'){
			  	div = $('<div class="info">').html('Nessun dato Presente<br><br>');
				$('#panelRisultatiVersione151').append(div);
			}
		},
	});
	
	params = $.param({
		timestamp : timestamp,
	});
	
	w2ui['gridVersione151'].load('esempiW2ui.php?versione=griglia151&'+params);
	w2ui['gridVersione151'].resize();
	w2ui['gridVersione151'].toolbar.disable('itemVariazione');
	
});

function getSelectedCheck(){
	
	records = w2ui['gridVersione151'].records;
	//console.log(records);

	check = $('.checkGrid:checkbox:checked');
	
	$(check).each(function(){
	  
	  value = this.attributes.value;
	  console.log(value);
	});

	$(records).each(function(){
		console.log(this);
	});
	
	
}

function variazioneDatoResidenza(arrayValori){

	residenzaCambiata = w2ui['gridVersione151'].getChanges();
		
	//Abbiamo recuperato i campi ma dobbiamo controllare se sono state editate le residenze, se il recid è stato
	//editato prendiamo le nuove residenze editate, lo facciamo qui quando l'operatore clicca la variazione che poi manda al server
	$(arrayValori).each(function(i,j){
		idArray = arrayValori[i].recid;
		console.log(idArray);
		$(residenzaCambiata).each(function(k,w){
			recidEditato = residenzaCambiata[k].recid;
			//console.log(recidEditato);
			residenzaEditataAggiornata = residenzaCambiata[k].cittaResidenza;
			if (recidEditato == idArray){
				arrayValori[i].cittaResidenza = residenzaEditataAggiornata;
			}	
		});
	});
		
	console.log(arrayValori);	
		
}

The Json result when the grid call/load the php can be seen here

https://fractalcosmo.com/MvcWebLog/esempiW2ui.php?versione=griglia151

Ciao
Andrea

PS:I NOTIFIED THAT THERE IS AN ERROR IN ARRAYVALORE ONSELECT AND ONUNSELECT SORTING THE COLUMN AND AFTER SELECT SOME RECORDS WITH THE NORMAL MULTISELECT, THE RECID IF THE COLUMN IS SORTED ISN'T RIGHT...I must see this also on my project.Grrr i saw it now...

PPS:I fixed the problem, the onSelect and onUnselect array worked well if column wasn't sorted, because the target was in order but after the sort the loop wasn't correct, instead now it's working well, i have updated the code over.....Bye

@ImAbhishekTomar
Copy link
Author

Thanks for support @spizzi77 - This is complex code but ok I will try to make code as per your suggestion if you have any simple solution please suggest.

@spizzi77
Copy link

spizzi77 commented Apr 3, 2017

Hy Jackryu,
It depends of what you must do with the second checkbox column(the inlude column), my example has two buttons, one work for the onSelect or OnUnSelect event of the w2ui grid object the other button is working only for the second column checkbox like as your inlude column....But you have just all two examples to see, copy my code but just comment this, because i haven't attached noNumeri function, but you can comment it.

			$('#grid_gridVersione151_edit_'+id+'_3').keypress(function(event){
				 return noNumeri(event);
			});

If you must only check if the checkbox in the column is checked when the user do the onSelect event, you can do it with a simple _id_numberColumn is(':checked'), it depends from what you must do with that include column checkbox...
Bye
Andrea

@ImAbhishekTomar
Copy link
Author

Thanks @spizzi77 i will try...

@ImAbhishekTomar
Copy link
Author

My issue is not resolve.

@mrg2001
Copy link
Collaborator

mrg2001 commented Apr 18, 2017

in records array, all fields are kept in the direct object

grid.records = [{ field1: 1, field2: 2}, {...}...]

However, after you changed a field, 2 copies will be stored: old one and new one. The new one in rec.w2ui.changes. So, I am guessing if you modify that, and refresh grid, then it will show the triangle.

Just a guess. See if this helps.

@ImAbhishekTomar
Copy link
Author

ImAbhishekTomar commented Apr 27, 2017

Hello - I tried your suggestion @mrg2001

     var newRecords = [];
                    var allRecords = w2ui['vwgrid'].records
                    allRecords.forEach(function (resp, i) {
                        resp.Between_Call_Marker = 0;
                        //JSON.stringify(resp).toString().replace('"Between_Call_Marker":1', '"Between_Call_Marker":0');
                        newRecords.push(resp);
                    });
                    w2ui['vwgrid'].records = newRecords;
                    w2ui['vwgrid'].refresh();
                    var grid = w2ui['vwgrid'].changes;

In "grid" variable updated records is not shown but on UI my all check box is unchecked. but red mark is not shown in front of updated record.

Current Problem : red mark not shown & Updated Records in not display in changesobject.

Your suggestion is good and you are very close to fix my problem thanks for your good!! suggestion.

Please help and suggest how to show red mark and update UI checkbox

@mpf82
Copy link
Collaborator

mpf82 commented Apr 28, 2017

@jackryu in the code you posted you're never touching record.w2ui.changes as @mrg2001 suggested.

Tip: Change one record manually, so that the red marker shows up and inspect that single record (log in to the console) and you will see that your record now has a property w2ui.

@ImAbhishekTomar
Copy link
Author

ImAbhishekTomar commented Apr 28, 2017

No this is not working .......

as per your suggestion i am trying below code but this is not working on UI checkbox is unchecked but red mark is not shown.

every thing is resolved excluding red mark

                    var changes = [];
                    var rec = w2ui['vwgrid'].records[0];
                    rec.Between_Call_Marker=0
                    changes.push($.extend(true, { recid: rec.recid }, rec));
                    w2ui['vwgrid'].changes = changes;
                    w2ui['vwgrid'].refresh();

Sorry : above code posted by mistake correct code is correct cod is

                    var oUpdate = [];
                    var ogrid = w2ui['vwgrid'];
                    for (var r = 0; r < ogrid.records.length; r++) {
                        var rec = ogrid.records[r];
                        rec.Between_Call_Marker = 0;
                        oUpdate.push(rec);
                        //rec.w2ui.changes  = rec
                    }
                    w2ui['vwgrid'].changes = oUpdate;
                    w2ui['vwgrid'].refresh();

Sorry for asking again and again but i am stack and this issue is critical fro me thank you very much for my support. But my issue still not resolved. please help me if possibly.

@mrg2001
Copy link
Collaborator

mrg2001 commented Apr 28, 2017

Please create a jsFiddle and I will fix it there.

@ImAbhishekTomar
Copy link
Author

ImAbhishekTomar commented Apr 28, 2017

jsfiddle attached @mrg2001 & @spizzi77

https://jsfiddle.net/JackRry/z5nvLf6j/8/

this is a jsfiddle link but W2ui not working on jsfiddle but my code is attached.


 $(function(){
 var dataSourceEmpty=[{"UID":5628,"UnitID":82,"UnitName":"PI","CAT_ID":81,"CAT_NAME":"AP Code","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":1,"Between_Call_Marker":1,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5812,"UnitID":82,"UnitName":"PI","CAT_ID":97,"CAT_NAME":"ByPassed Forced Edits","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":2,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5627,"UnitID":82,"UnitName":"PI","CAT_ID":79,"CAT_NAME":"Accident","ExperienceLevel":3,"ExperienceLevelDescription":"Level 3 (0-3 Mos) - Checklimit <=2500","Include":1,"Packet_Size":20,"Sort":3,"Between_Call_Marker":1,"Difficulty":"Easy      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":41878,"UnitID":82,"UnitName":"PI","CAT_ID":10000,"CAT_NAME":"#Test Rule 001","ExperienceLevel":0,"ExperienceLevelDescription":"Level 0 Tier 1 Inventory","Include":1,"Packet_Size":10,"Sort":10,"Between_Call_Marker":1,"Difficulty":"1         ","Comment":"Test Rule For... Testing.","AuditDate":"2017-04-25T12:30:31.26","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/25/17 12:30 PM by atomar10"},{"UID":5824,"UnitID":82,"UnitName":"PI","CAT_ID":123,"CAT_NAME":"Top Priorities","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":100,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5825,"UnitID":82,"UnitName":"PI","CAT_ID":125,"CAT_NAME":"UW Alliance Claims","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":105,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5832,"UnitID":82,"UnitName":"PI","CAT_ID":139,"CAT_NAME":"Appeal Call Traks","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":108,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5827,"UnitID":82,"UnitName":"PI","CAT_ID":129,"CAT_NAME":"Rush Call Traks","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":110,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5826,"UnitID":82,"UnitName":"PI","CAT_ID":127,"CAT_NAME":"IVR Rejects","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":115,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5828,"UnitID":82,"UnitName":"PI","CAT_ID":131,"CAT_NAME":"Priority 0 Claims","ExperienceLevel":5,"ExperienceLevelDescription":"Level 5 (6-9 Mos) - Checklimit <=2500","Include":1,"Packet_Size":20,"Sort":120,"Between_Call_Marker":0,"Difficulty":"Med_Hard  ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5831,"UnitID":82,"UnitName":"PI","CAT_ID":137,"CAT_NAME":"20/59 adjustments","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":125,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5836,"UnitID":82,"UnitName":"PI","CAT_ID":147,"CAT_NAME":"More Focus Required (TAT, Concerns, etc)","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":130,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5829,"UnitID":82,"UnitName":"PI","CAT_ID":133,"CAT_NAME":"U99/P99 Claims-Secondary Discounts/Provider OPIs","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":135,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5830,"UnitID":82,"UnitName":"PI","CAT_ID":135,"CAT_NAME":"OPEN NOT Used","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":140,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5833,"UnitID":82,"UnitName":"PI","CAT_ID":141,"CAT_NAME":"Claims Quality Returns","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":150,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5834,"UnitID":82,"UnitName":"PI","CAT_ID":143,"CAT_NAME":"Regular Call Traks","ExperienceLevel":0,"ExperienceLevelDescription":"Level 0 Tier 1 Inventory","Include":1,"Packet_Size":20,"Sort":180,"Between_Call_Marker":0,"Difficulty":"Easy      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5835,"UnitID":82,"UnitName":"PI","CAT_ID":145,"CAT_NAME":"Regular Onbase Docs","ExperienceLevel":0,"ExperienceLevelDescription":"Level 0 Tier 1 Inventory","Include":1,"Packet_Size":20,"Sort":190,"Between_Call_Marker":0,"Difficulty":"Easy      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5629,"UnitID":82,"UnitName":"PI","CAT_ID":87,"CAT_NAME":"Manual Reject Claims","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":500,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5630,"UnitID":82,"UnitName":"PI","CAT_ID":89,"CAT_NAME":"Medical Necessity","ExperienceLevel":5,"ExperienceLevelDescription":"Level 5 (6-9 Mos) - Checklimit <=2500","Include":1,"Packet_Size":20,"Sort":500,"Between_Call_Marker":0,"Difficulty":"Med_Hard  ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5631,"UnitID":82,"UnitName":"PI","CAT_ID":91,"CAT_NAME":"Misc_Non_Coded","ExperienceLevel":5,"ExperienceLevelDescription":"Level 5 (6-9 Mos) - Checklimit <=2500","Include":1,"Packet_Size":20,"Sort":500,"Between_Call_Marker":0,"Difficulty":"Med_Hard  ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5632,"UnitID":82,"UnitName":"PI","CAT_ID":93,"CAT_NAME":"C-ABC","ExperienceLevel":7,"ExperienceLevelDescription":"Level 7 (>1Yr) or Checklimit <=5000","Include":1,"Packet_Size":15,"Sort":500,"Between_Call_Marker":0,"Difficulty":"Hard      ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"},{"UID":5811,"UnitID":82,"UnitName":"PI","CAT_ID":95,"CAT_NAME":"Possible Denial - Dental","ExperienceLevel":6,"ExperienceLevelDescription":"Level 6  (<1Yr) - Checklimit <=5000","Include":1,"Packet_Size":20,"Sort":500,"Between_Call_Marker":0,"Difficulty":"Medium    ","Comment":null,"AuditDate":"2017-04-18T06:11:15.88","AuditUser":"MS\\atomar10","RuleStartDate":null,"RuleEndDate":null,"LastModified":"04/18/17 06:11 AM by atomar10"}];
    
    
    var mygrid = $('#grid').w2grid({
        name: 'vwgrid',
        style: 'text-align: center',
        recid: 'CAT_ID',
        header: "Inventory Inquiry View",
        fixedBody: true,
        reorderColumns: false,
        multiSearch: true,
        show: {
            expandColumn: false,
            header: false,
            selectionBorder: false,
            toolbar: true,
            footer: true,
            lineNumbers: true,
            selectColumn: true,
            toolbarSave: true,
            toolbarEdit: false,
        },
onSave: function (event) {
            var editedRecord = JSON.stringify(event.changes);
            SaveInquiryDataTable(finalJson);
        },
        columns: [
                { field: 'CAT_ID', caption: 'Row ID', type: 'int', size: '5%', sortable: true, hidden: true },
                { field: 'CAT_NAME', caption: 'Category Name', type: 'text', size: '35%', sortable: true, style: 'text-align: left', info: true },
                { field: 'UnitName', caption: 'Unit Name', type: 'text', size: '6%', sortable: true },
                { field: 'Difficulty', caption: 'Difficulty', type: 'text', size: '9%', sortable: true },
                { field: 'Between_Call_Marker', caption: 'Call Marker', type: 'int', size: '8%', sortable: true, editable: { type: 'checkbox', style: 'text-align: center' }, },
                { field: 'ExperienceLevel', caption: 'Experience Level', type: 'int', size: '9%', sortable: true, editable: { type: 'int', style: 'text-align: center' }, },
                { field: 'Packet_Size', caption: 'Packet Size', type: 'int', size: '9%', sortable: true, editable: { type: 'int', style: 'text-align: center' }, },
                { field: 'Sort', caption: 'Sort', type: 'int', size: '5%', sortable: true, editable: { type: 'int', style: 'text-align: center' }, },
                { field: 'Include', caption: 'Include', type: 'checkbox', size: '5%', sortable: true, editable: { type: 'checkbox', style: 'text-align: center' }, },
                { field: 'RuleStartDate', caption: 'RuleStartDate', size: '5%', sortable: true, render: 'datetime', editable: { type: 'datetime' }, hidden: true },
                { field: 'RuleEndDate', caption: 'RuleEndDate', size: '5%', sortable: true, editable: { type: 'datetime' }, hidden: true },
        ],
        toolbar: {
            items: [

                { type: 'Select/Unselect', id: 'btnInclude', caption: 'Check', img: 'icon-page', checked: true },

            ],
            onClick: function (event) {
           if (event.target == 'btnInclude') {
                    //grid.records

                    var changes = [];
                    var rec = w2ui['vwgrid'].records[0];
                    rec.Between_Call_Marker = false;
                    //changes.push($.extend(true, { recid: rec.recid }, rec));
                    changes.push($.extend(true, { recid: rec.recid }, rec));
                    w2ui['vwgrid'].changes = changes;
                    w2ui['vwgrid'].refresh();
                    w2ui['vwgrid'].toolbar.enable('w2ui-save');
                  
                }
              
            }
        },
       
        records: dataSourceEmpty || []
    });
    });

Requirment : if I am click on "btnInclude" this button then i need to "Between_Call_Marker" torggal this column check box and data show in "getChange" object and Red mark is show if record is update.

@ImAbhishekTomar
Copy link
Author

Please Help......... ?

@mrg2001
Copy link
Collaborator

mrg2001 commented May 8, 2017

Here you go http://jsfiddle.net/z5nvLf6j/10/

@mrg2001 mrg2001 closed this as completed May 8, 2017
@ImAbhishekTomar
Copy link
Author

Thank!! You @mrg2001 appreciated!!!! your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants