I am using DBContext.Update(ParentEntity) to update an entity. Then I loop through each of the Entities property.CurrentValue and property.OriginalValue.
The problem I am facing is that CurrentValues and OriginalValues are the same even though one Property has been changed and is different from the DB. I was expecting to get OriginalValues from the Database.
Heres the loop that happens before saving changes.
foreach (var entry in ChangeTracker.Entries())
{
if (entry.Entity is Audit || entry.State == EntityState.Detached || entry.State == EntityState.Unchanged ||entry.Entity is ChangelogUser)
continue;
var auditEntry = new AuditEntry(entry) {TableName = entry.Metadata.Relational().TableName};
auditEntries.Add(auditEntry);
foreach (var property in entry.Properties)
{
if (property.IsTemporary)
{
// value will be generated by the database, get the value after saving
auditEntry.TemporaryProperties.Add(property);
continue;
}
string propertyName = property.Metadata.Name;
if (property.Metadata.IsPrimaryKey())
{
auditEntry.KeyValues[propertyName] = property.CurrentValue;
continue;
}
switch (entry.State)
{
case EntityState.Added:
auditEntry.NewValues[propertyName] = property.CurrentValue;
break;
case EntityState.Deleted:
auditEntry.OldValues[propertyName] = property.OriginalValue;
break;
case EntityState.Modified:
if (property.CurrentValue != null)
{
if (property.OriginalValue != null && property.CurrentValue != null)
{
if (property.IsModified && !property.CurrentValue.Equals(property.OriginalValue))
{
auditEntry.OldValues[propertyName] = property.OriginalValue;
auditEntry.NewValues[propertyName] = property.CurrentValue;
}
}
}
break;
}
}
From this code I AWLAYS get the same Original and Current values. Is there some way to get the Original Values from the DB and set them on the Entity?
Since it is suuuper difficult to get an answer for EFCore Questions hereĀ“s the solution I came up with.
Check out the State.Modified section. I Iterate through each entity and then iterate through each property. In this case, I am using the current and original values to compare them and only add them to my audit table when something has changed.
At the end of the method I remove the Entities that have not changed from my audit table. Simple mimple.
You could use this the var databaseValues = entry.GetDatabaseValues(); To for your custom disconnected scenario needs.
var auditEntries = new List<AuditEntry>();
foreach (var entry in ChangeTracker.Entries())
{
if (entry.Entity is Audit || entry.State == EntityState.Detached || entry.State == EntityState.Unchanged)
continue;
var auditEntry = new AuditEntry(entry) {TableName = entry.Metadata.Relational().TableName};
auditEntries.Add(auditEntry);
var databaseValues = entry.GetDatabaseValues();
foreach (var property in entry.Properties)
{
if (property.IsTemporary)
{
// value will be generated by the database, get the value after saving
auditEntry.TemporaryProperties.Add(property);
continue;
}
string propertyName = property.Metadata.Name;
if (property.Metadata.IsPrimaryKey())
{
auditEntry.KeyValues[propertyName] = property.CurrentValue;
continue;
}
switch (entry.State)
{
case EntityState.Added:
auditEntry.NewValues[propertyName] = property.CurrentValue;
break;
case EntityState.Deleted:
auditEntry.OldValues[propertyName] = property.OriginalValue;
break;
case EntityState.Modified:
if (property.CurrentValue != null)
{
if (databaseValues[propertyName] != null && property.CurrentValue != null)
{
if (property.IsModified && !property.CurrentValue.Equals(databaseValues[propertyName]))
{
auditEntry.OldValues[propertyName] = databaseValues[propertyName];
auditEntry.NewValues[propertyName] = property.CurrentValue;
}
}
}
break;
}
}
if (auditEntry.NewValues.Equals(auditEntry.OldValues) || auditEntry.NewValues.Count == 0 && auditEntry.OldValues.Count == 0)
{
auditEntries.Remove(auditEntry);
}
Related
Below is my override saveChanges Methed which calls SetChanges Method
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
SetChanges();
OnBeforeSaving();
return base.SaveChanges(acceptAllChangesOnSuccess);
}
Right now, Sometimes code works completely fine but in some scenario It gives same value of both property.OriginalValue and property.CurrentValue for Modification so I am not able find what is the issue in my code
private void SetChanges()
{
Guid SystemLogId = Guid.NewGuid();
var currentDate = DateTime.Now;
var entitiesTracker = ChangeTracker.Entries()
.Where(p => p.State == EntityState.Modified || p.State == EntityState.Added).ToList();
foreach (var entry in entitiesTracker)
{
var pagename = entry.Entity.GetType().Name;
if (pagename != "ExceptionLog")
{
var rowid = 0;
try
{
rowid = int.Parse(entry.OriginalValues["Id"].ToString());
}
catch (Exception)
{ }
SystemLog sysLog = new SystemLog();
List<SystemChangeLog> changeLog = new List<SystemChangeLog>();
foreach (PropertyEntry property in entry.Properties)
{
string propertyName = property.Metadata.Name;
switch (entry.State)
{
case EntityState.Added:
sysLog.Event = "Created";
break;
case EntityState.Modified:
{
sysLog.Event = "Updated";
if (propertyName != "ModifiedDate" && propertyName != "CreatedDate" && propertyName != "ModifiedBy" && propertyName != "CreatedBy" && propertyName != "RowVersion")
{
var original = Convert.ToString(property.OriginalValue);
var current = Convert.ToString(property.CurrentValue);
if (property.IsModified && !original.Equals(current))
{
SystemChangeLog log = new SystemChangeLog()
{
Property = propertyName,
OldValue = original,
NewValue = current,
DateOfChange = currentDate,
rowid = rowid,
SystemLogId = SystemLogId.ToString(),
};
changeLog.Add(log);
}
}
}
break;
}
}
base.Set<SystemChangeLog>().AddRange(changeLog);
if(changeLog.Count() >0 || entry.State == EntityState.Added)
{
sysLog.UserId = UserId;
sysLog.Date = currentDate;
sysLog.Page = pagename;
sysLog.Location = ExceptionHandler(entry, "Location");
sysLog.IPAddress = ExceptionHandler(entry, "IPAddress");
sysLog.MACAddress = ExceptionHandler(entry, "MACAddress");
sysLog.SystemLogId = SystemLogId.ToString();
base.Set<SystemLog>().Add(sysLog);
}
}
}
}
And also Is there any way to make it fast for more than thousand entry
hope below code can help:
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
setChanges(); // to get new value and old value
var result = base.SaveChanges(acceptAllChangesOnSuccess);
OnAfterSaveChanges();// to get auto added id
return result;
}
Given a linked List $link1, with elements (a->b->c->d->e->f->g->h->i->j), we need to reverse the linked list provided that the reversing will be done in a manner like -
Reverse 1st element (a)
Reverse next 2 elements (a->c->b)
Reverse next 3 elements (a->c->b->f->e->d)
Reverse next 4 elements (a->c->b->f->e->d->j->i->h->g)
....
....
I have created below code in PHP to solve this problem
Things I need -
I need to calculate the time complexity of reverseLinkedList function below.
Need to know if we can optimize reverseLinkedList function to reduce time complexity.
-
class ListNode
{
public $data;
public $next;
function __construct($data)
{
$this->data = $data;
$this->next = NULL;
}
function read_node()
{
return $this->data;
}
}
class LinkList
{
private $first_node;
private $last_node;
private $count;
function __construct()
{
$this->first_node = NULL;
$this->last_node = NULL;
$this->count = 0;
}
function size()
{
return $this->count;
}
public function read_list()
{
$listData = array();
$current = $this->first_node;
while($current != NULL)
{
echo $current->read_node().' ';
$current = $current->next;
}
}
public function reverse_list()
{
if(($this->first_node != NULL)&&($this->first_node->next != NULL))
{
$current = $this->first_node;
$new = NULL;
while ($current != NULL)
{
$temp = $current->next;
$current->next = $new;
$new = $current;
$current = $temp;
}
$this->first_node = $new;
}
}
public function read_node($position)
{
if($position <= $this->count)
{
$current = $this->first_node;
$pos = 1;
while($pos != $position)
{
if($current->next == NULL)
return null;
else
$current = $current->next;
$pos++;
}
return $current->data;
}
else
return NULL;
}
public function insert($data)
{
$new_node = new ListNode($data);
if($this->first_node != NULL)
{
$this->last_node->next = $new_node;
$new_node->next = NULL;
$this->last_node = &$new_node;
$this->count++;
}
else
{
$new_node->next = $this->first_node;
$this->first_node = &$new_node;
if($this->last_node == NULL)
$this->last_node = &$new_node;
$this->count++;
}
}
}
//Create linked list
$link1 = new LinkList();
//Insert elements
$link1->insert('a');
$link1->insert('b');
$link1->insert('c');
$link1->insert('d');
$link1->insert('e');
$link1->insert('f');
$link1->insert('g');
$link1->insert('h');
$link1->insert('i');
$link1->insert('j');
echo "<b>Input :</b><br>";
$link1->read_list();
//function to reverse linked list in specified manner
function reverseLinkedList(&$link1)
{
$size= $link1->size();
if($size>2)
{
$link2=new LinkList();
$link2->insert($link1->read_node(1));
$elements_covered=1;
//reverse
$rev_size=2;
while($elements_covered<$size)
{
$start=$elements_covered+1;
$temp_link = new LinkList();
$temp_link->insert($link1->read_node($start));
for($i=1;$i<$rev_size;$i++)
{
$temp_link->insert($link1->read_node(++$start));
}
$temp_link->reverse_list();
$temp_size=$temp_link->size();
$link2_size=$link2->size();
for($i=1;$i<=$temp_size;$i++)
{
$link2->insert($temp_link->read_node($i));
++$elements_covered;
++$link2_size;
}
++$rev_size;
}
///reverse
//Flip the linkedlist
$link1=$link2;
}
}
///function to reverse linked list in specified manner
//Reverse current linked list $link1
reverseLinkedList($link1);
echo "<br><br><b>Output :</b><br>";
$link1->read_list();
It's O(n)...just one traversal.
And secondly, here tagging it in language is not necessary.
I have provided a Pseudocode here for your reference:
current => head_ref
prev => NULL;
current => head_ref;
next => null;
while (current != NULL)
{
next = current->next;
current->next = prev;
prev = current;
current = next;
}
*head_ref = prev;
I am using iTextSharp to create pdf. I have 100k records, but I am getting following exception:
An exception of type 'System.OutOfMemoryException' occurred in
itextsharp.dll but was not handled in user code At the line:
bodyTable.AddCell(currentProperty.GetValue(lst, null).ToString());
Code is:
var doc = new Document(pageSize);
PdfWriter.GetInstance(doc, stream);
doc.Open();
//Get exportable count
int columns = 0;
Type currentType = list[0].GetType();
//PREPARE HEADER
//foreach visible columns check if current object has proerpty
//else search in inner properties
foreach (var visibleColumn in visibleColumns)
{
if (currentType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key) != null)
{
columns++;
}
else
{
//check child property objects
var childProperties = currentType.GetProperties();
foreach (var prop in childProperties)
{
if (prop.PropertyType.BaseType == typeof(BaseEntity))
{
if (prop.PropertyType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key) != null)
{
columns++;
break;
}
}
}
}
}
//header
var headerTable = new PdfPTable(columns);
headerTable.WidthPercentage = 100f;
foreach (var visibleColumn in visibleColumns)
{
if (currentType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key) != null)
{
//headerTable.AddCell(prop.Name);
headerTable.AddCell(visibleColumn.Value);
}
else
{
//check child property objects
var childProperties = currentType.GetProperties();
foreach (var prop in childProperties)
{
if (prop.PropertyType.BaseType == typeof(BaseEntity))
{
if (prop.PropertyType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key) != null)
{
//headerTable.AddCell(prop.Name);
headerTable.AddCell(visibleColumn.Value);
break;
}
}
}
}
}
doc.Add(headerTable);
var bodyTable = new PdfPTable(columns);
bodyTable.Complete = false;
bodyTable.WidthPercentage = 100f;
//PREPARE DATA
foreach (var lst in list)
{
int col = 1;
foreach (var visibleColumn in visibleColumns)
{
var currentProperty = currentType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key);
if (currentProperty != null)
{
if (currentProperty.GetValue(lst, null) != null)
bodyTable.AddCell(currentProperty.GetValue(lst, null).ToString());
else
bodyTable.AddCell(string.Empty);
col++;
}
else
{
//check child property objects
var childProperties = currentType.GetProperties().Where(p => p.PropertyType.BaseType == typeof(BaseEntity));
foreach (var prop in childProperties)
{
currentProperty = prop.PropertyType.GetProperties().FirstOrDefault(p => p.Name == visibleColumn.Key);
if (currentProperty != null)
{
var currentPropertyObjectValue = prop.GetValue(lst, null);
if (currentPropertyObjectValue != null)
{
bodyTable.AddCell(currentProperty.GetValue(currentPropertyObjectValue, null).ToString());
}
else
{
bodyTable.AddCell(string.Empty);
}
break;
}
}
}
}
}
doc.Add(bodyTable);
doc.Close();
A back of the envelope computation of the memory requirements given the data you provided for memory consumption gives 100000 * 40 * (2*20+4) = 167MBs. Well within your memory limit, but it is just a lower bound. I imagine each Cell object is pretty big. If each cell would have a 512 byte overhead you could be well looking at 2GB taken. I reckon it might be even more, as PDF is a complex beast.
So you might realistically be looking at a situation where you are actually running out of memory. If not your computers, then at least the bit C# has set aside for its own thing.
I would do one thing first - check memory consumption like here. You might even do well to try with 10, 100, 1000, 10000, 100000 rows and see up until what number of rows the program works.
You could perhaps try a different thing altogether. If you're trying to print a nicely formatted table with a lot of data, perhaps you could output an HTML document, which can be done incrementally and which you can do by just writing stuff to a file, rather than using a third party library. You can then "print" that HTML document to PDF. StackOverflow to the rescue again with this problem.
Is there any way to add Sales Tax Item using QBFC?
Example:
Sales Tax A
4%
Sales Tax B
10%
I can add it easily from Quickbooks, but I need a way to add from external application using QBFC.
Any help will be greatly appreciated.
You can find a good example in the On Screen Reference.
At the top of the screen choose ItemSalesTaxAdd from the "Select Message" dropdown. From there click on the C# tab and you will see the following sample code:
//The following sample code is generated as an illustration of
//Creating requests and parsing responses ONLY
//This code is NOT intended to show best practices or ideal code
//Use at your most careful discretion
using System;
using System.Net;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Interop.QBFC10;
namespace com.intuit.idn.samples
{
public class Sample
{
public void DoItemSalesTaxAdd()
{
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US",1,.0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
BuildItemSalesTaxAddRq(requestMsgSet);
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("","Sample Code from OSR");
connectionOpen = true;
sessionManager.BeginSession("", ENOpenMode.omDontCare);
sessionBegun = true;
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
//End the session and close the connection to QuickBooks
sessionManager.EndSession();
sessionBegun = false;
sessionManager.CloseConnection();
connectionOpen = false;
WalkItemSalesTaxAddRs(responseMsgSet);
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error");
if (sessionBegun)
{
sessionManager.EndSession();
}
if (connectionOpen)
{
sessionManager.CloseConnection();
}
}
}
void BuildItemSalesTaxAddRq(IMsgSetRequest requestMsgSet)
{
IItemSalesTaxAdd ItemSalesTaxAddRq= requestMsgSet.AppendItemSalesTaxAddRq();
//Set field value for Name
ItemSalesTaxAddRq.Name.SetValue("ab");
//Set field value for BarCodeValue
ItemSalesTaxAddRq.BarCode.BarCodeValue.SetValue("ab");
//Set field value for AssignEvenIfUsed
ItemSalesTaxAddRq.BarCode.AssignEvenIfUsed.SetValue(true);
//Set field value for AllowOverride
ItemSalesTaxAddRq.BarCode.AllowOverride.SetValue(true);
//Set field value for IsActive
ItemSalesTaxAddRq.IsActive.SetValue(true);
//Set field value for ListID
ItemSalesTaxAddRq.ClassRef.ListID.SetValue("200000-1011023419");
//Set field value for FullName
ItemSalesTaxAddRq.ClassRef.FullName.SetValue("ab");
//Set field value for ItemDesc
ItemSalesTaxAddRq.ItemDesc.SetValue("ab");
//Set field value for TaxRate
ItemSalesTaxAddRq.TaxRate.SetValue(20.00);
//Set field value for ListID
ItemSalesTaxAddRq.TaxVendorRef.ListID.SetValue("200000-1011023419");
//Set field value for FullName
ItemSalesTaxAddRq.TaxVendorRef.FullName.SetValue("ab");
//Set field value for ExternalGUID
ItemSalesTaxAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString());
//Set field value for IncludeRetElementList
//May create more than one of these if needed
ItemSalesTaxAddRq.IncludeRetElementList.Add("ab");
}
void WalkItemSalesTaxAddRs(IMsgSetResponse responseMsgSet)
{
if (responseMsgSet == null) return;
IResponseList responseList = responseMsgSet.ResponseList;
if (responseList == null) return;
//if we sent only one request, there is only one response, we'll walk the list for this sample
for (int i=0; i<responseList.Count; i++)
{
IResponse response = responseList.GetAt(i);
//check the status code of the response, 0=ok, >0 is warning
if (response.StatusCode >= 0)
{
//the request-specific response is in the details, make sure we have some
if (response.Detail != null)
{
//make sure the response is the type we're expecting
ENResponseType responseType = (ENResponseType)response.Type.GetValue();
if (responseType == ENResponseType.rtItemSalesTaxAddRs)
{
//upcast to more specific type here, this is safe because we checked with response.Type check above
IItemSalesTaxRet ItemSalesTaxRet = (IItemSalesTaxRet)response.Detail;
WalkItemSalesTaxRet(ItemSalesTaxRet);
}
}
}
}
}
void WalkItemSalesTaxRet(IItemSalesTaxRet ItemSalesTaxRet)
{
if (ItemSalesTaxRet == null) return;
//Go through all the elements of IItemSalesTaxRet
//Get value of ListID
string ListID1 = (string)ItemSalesTaxRet.ListID.GetValue();
//Get value of TimeCreated
DateTime TimeCreated2 = (DateTime)ItemSalesTaxRet.TimeCreated.GetValue();
//Get value of TimeModified
DateTime TimeModified3 = (DateTime)ItemSalesTaxRet.TimeModified.GetValue();
//Get value of EditSequence
string EditSequence4 = (string)ItemSalesTaxRet.EditSequence.GetValue();
//Get value of Name
string Name5 = (string)ItemSalesTaxRet.Name.GetValue();
//Get value of BarCodeValue
if (ItemSalesTaxRet.BarCodeValue != null)
{
string BarCodeValue6 = (string)ItemSalesTaxRet.BarCodeValue.GetValue();
}
//Get value of IsActive
if (ItemSalesTaxRet.IsActive != null)
{
bool IsActive7 = (bool)ItemSalesTaxRet.IsActive.GetValue();
}
if (ItemSalesTaxRet.ClassRef != null)
{
//Get value of ListID
if (ItemSalesTaxRet.ClassRef.ListID != null)
{
string ListID8 = (string)ItemSalesTaxRet.ClassRef.ListID.GetValue();
}
//Get value of FullName
if (ItemSalesTaxRet.ClassRef.FullName != null)
{
string FullName9 = (string)ItemSalesTaxRet.ClassRef.FullName.GetValue();
}
}
//Get value of ItemDesc
if (ItemSalesTaxRet.ItemDesc != null)
{
string ItemDesc10 = (string)ItemSalesTaxRet.ItemDesc.GetValue();
}
//Get value of TaxRate
if (ItemSalesTaxRet.TaxRate != null)
{
double TaxRate11 = (double)ItemSalesTaxRet.TaxRate.GetValue();
}
if (ItemSalesTaxRet.TaxVendorRef != null)
{
//Get value of ListID
if (ItemSalesTaxRet.TaxVendorRef.ListID != null)
{
string ListID12 = (string)ItemSalesTaxRet.TaxVendorRef.ListID.GetValue();
}
//Get value of FullName
if (ItemSalesTaxRet.TaxVendorRef.FullName != null)
{
string FullName13 = (string)ItemSalesTaxRet.TaxVendorRef.FullName.GetValue();
}
}
//Get value of ExternalGUID
if (ItemSalesTaxRet.ExternalGUID != null)
{
string ExternalGUID14 = (string)ItemSalesTaxRet.ExternalGUID.GetValue();
}
if (ItemSalesTaxRet.DataExtRetList != null)
{
for (int i15 = 0; i15 < ItemSalesTaxRet.DataExtRetList.Count; i15++)
{
IDataExtRet DataExtRet = ItemSalesTaxRet.DataExtRetList.GetAt(i15);
//Get value of OwnerID
if (DataExtRet.OwnerID != null)
{
string OwnerID16 = (string)DataExtRet.OwnerID.GetValue();
}
//Get value of DataExtName
string DataExtName17 = (string)DataExtRet.DataExtName.GetValue();
//Get value of DataExtType
ENDataExtType DataExtType18 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
//Get value of DataExtValue
string DataExtValue19 = (string)DataExtRet.DataExtValue.GetValue();
}
}
}
}
}
You can add each tax item as a line item. Make sure you set the invoice to a 0 tax, so tax is not calculated on top of tax.
You would have line item sales tax A and another line item sales tax B.
I have a jqGrid in an ASP.NET MVC View with the option multiselect:true. There are over 200 records displayed in the grid, so I have paging enabled. This works great, but when I navigate from page to page, the selections are lost when I navigate.
Is there a good, clean way to persist the selections so that they are maintained while paging?
Managed it with some javascript trickery:
var pages = [];
onSelectRow: function(rowid, status) {
var pageId = $('#grdApplications').getGridParam('page');
var selRows = [];
if (status) {
//item selected, add index to array
if (pages[pageId] == null) {
pages[pageId] = [];
}
selRows = pages[pageId];
if (selRows.indexOf(rowid) == -1)
{ selRows.push(rowid); }
}
else {
//item deselected, remove from array
selRows = pages[pageId];
var index = selRows.indexOf(rowid)
if (index != -1) {
pages[pageId].splice(index, 1);
}
}
},
loadComplete: function() {
if (pages[$('#grdApplications').getGridParam('page')] != null) {
var selRows = pages[$('#grdApplications').getGridParam('page')];
var i;
var limit = selRows.length;
for (i = 0; i < limit; i++) {
$('#grdApplications').setSelection(selRows[i], true);
}
}
},
user279248 (I know it's an old post, but it's a good question) - all of the row ids are being stored in the selRows arrays in the pages array, so just iterate through them, ie
for (j=0;j<pages.length;j++) {
var selRow = pages[j];
for (k=0;k<selRow.length;k++) {
alert('RowID:'+selRow[k]);
}
}
Hope this helps someone.
Dave - your solution is still going strong two years later! Thanks for the code. My only tweak is elevating the code into functions - useful to apply to multiple grids on the same page.
function maint_chkbxs_oSR(obj_ref, rowid, status, pages) {
var pageId = $(obj_ref).jqGrid('getGridParam','page');
var selRows = [];
if (status) {
//item selected, add index to array
if (pages[pageId] == null) {
pages[pageId] = [];
}
selRows = pages[pageId];
//if (selRows.indexOf(rowid) == -1)
if ($.inArray(""+rowid,selRows) == -1)
{ selRows.push(rowid); }
}
else {
//item deselected, remove from array
selRows = pages[pageId];
var index = $.inArray(""+rowid,selRows);
if (index != -1) {
pages[pageId].splice(index, 1);
}
}
}
function maint_ckbxs_lC(obj_ref, pages) {
if (pages[$(obj_ref).jqGrid('getGridParam','page')] != null) {
var selRows = pages[$(obj_ref).jqGrid('getGridParam','page')];
var i;
var limit = selRows.length;
for (i = 0; i < limit; i++) {
//$('#grid_bucket').setSelection(selRows[i], true);
$(obj_ref).jqGrid('setSelection',selRows[i],true);
}
}
}
You just have to remember to create a dedicated page array for each grid.