Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 03-24-2008, 06:16 PM
neerajnandwana neerajnandwana is offline
Ext User
 
Join Date: Dec 2007
Posts: 38
neerajnandwana is on a distinguished road
Question storeX - storeY ?

hi
i am trying something like that:

StoreZ= StoreX-StoreY

i want to remove all the record from StoreX which is in StoreY and rest record i want to assign to StoreZ.

Can anyone help me

Thanks in advance
Neeraj
Reply With Quote
  #2  
Old 03-25-2008, 10:52 AM
neerajnandwana neerajnandwana is offline
Ext User
 
Join Date: Dec 2007
Posts: 38
neerajnandwana is on a distinguished road
Default

Can we use the filter to solve this?
But how?
Reply With Quote
  #3  
Old 03-25-2008, 12:31 PM
mjlecomte mjlecomte is offline
Ext JS - Quality Assurance Team
 
Join Date: Jul 2007
Location: Florida
Posts: 9,995
mjlecomte is on a distinguished road
Default

Sounds easier to implement server side with some kind of join?

If you can't do that post some code that you're working with. Your question is too vague to make suggestions on I think. You have records, remove them from one store and add them to another store. How you're going to implement that depends on your business logic, no?
Reply With Quote
  #4  
Old 03-25-2008, 06:14 PM
neerajnandwana neerajnandwana is offline
Ext User
 
Join Date: Dec 2007
Posts: 38
neerajnandwana is on a distinguished road
Default

I am implementing the itemselector.

items:[{
					xtype:"itemselector",
					id: "itemSelectorID",
					name:"itemSelector",
					hiddenName:"itemSelector",
					fieldLabel:"ItemSelector",
					dataFields:["id", "display"],
					mode:"local",
					toStore: xStore,
					fromStore: yStore,
					msWidth:370,
					msHeight:225,
					valueField:"id",
					displayField:"display",				
					toLegend:"Assigned",
					fromLegend:"Available",
					stripe:true
}]
where xStore and yStore

var xStore = new Ext.data.Store({
				reader : jsonReader,
				autoLoad : true,
				proxy : new Ext.data.HttpProxy({
						url : 'loadXStore.action'	
				})
			});

var yStore = new Ext.data.Store({
					reader : jsonReader,
					autoLoad : true,
					proxy : new Ext.data.HttpProxy({
							url : 'loadYStore.action'	
					})
				});
And i want to remove all record from yStore which is present in XStore.

Thanks for your reply mjlecomte
Reply With Quote
  #5  
Old 03-25-2008, 06:51 PM
evant's Avatar
evant evant is offline
Ext JS - Development Team
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 8,188
evant is on a distinguished road
Default

I don't really see how this is a problem? Loop through each record in X, compare it against each record in Y, fill a store with the difference.
Reply With Quote
  #6  
Old 03-27-2008, 07:28 PM
neerajnandwana neerajnandwana is offline
Ext User
 
Join Date: Dec 2007
Posts: 38
neerajnandwana is on a distinguished road
Default

I am trying like this but it gives some error -B[A] has no properties
var xStore = new Ext.data.Store({
				reader : jsonReader,
				autoLoad : true,
				proxy : new Ext.data.HttpProxy({
						url : 'loadXStore.action'	
				})
			});

var yStore = new Ext.data.Store({
					reader : jsonReader,
					autoLoad : true,
					proxy : new Ext.data.HttpProxy({
							url : 'loadYStore.action'	
					}),
                                        listeners:{
					    load :{fn:function(thisStore,option){
						for(var i=1;i<this.getTotalCount();i++){
							xStore.remove(this.getAt(i));//ERROR-B[A] has no properties							
						}						
					   }}
			               }
				});
Reply With Quote
  #7  
Old 03-27-2008, 08:16 PM
mjlecomte mjlecomte is offline
Ext JS - Quality Assurance Team
 
Join Date: Jul 2007
Location: Florida
Posts: 9,995
mjlecomte is on a distinguished road
Default

are you use ext-all-debug.js so you can inspect errors easier?

did you inspect via firebug to see what xstore is inside that function?

Looks like a scope problem to me.

Also looks like you should make sure xstore is loaded before operating on it.

var yStore = new Ext.data.Store({
					reader : jsonReader,
					autoLoad : true,
					proxy : new Ext.data.HttpProxy({
							url : 'loadYStore.action'	
					}),
                                        listeners:{
					    load :{fn:function(thisStore,option){
console.log('inside load listener, xStore = ', xStore);//undefined?
						for(var i=1;i<this.getTotalCount();i++){
							xStore.remove(this.getAt(i));//ERROR-B[A] has no properties							
						}						
					   }}
			               }
				});
Reply With Quote
  #8  
Old 03-27-2008, 08:42 PM
neerajnandwana neerajnandwana is offline
Ext User
 
Join Date: Dec 2007
Posts: 38
neerajnandwana is on a distinguished road
Default

I think it is trying to find the startIndex and endIndex but these store i am using in Multiselect box mean no startIndex and endIndex.

ext-all-debug.js
.......
updateIndexes : function(startIndex, endIndex){
	var ns = this.all.elements;
	startIndex = startIndex || 0;
	endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
	for(var i = startIndex; i <= endIndex; i++){
		ns[i].viewIndex = i;//ERROR-ns[i] has no properties
	}
},
.........
can we not remove the record through this way?
And what should be the alternative way to remove the record?
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 11:09 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.