Ext


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

Reply
 
Thread Tools
  #1  
Old 06-30-2008, 09:47 AM
hui2008 hui2008 is offline
Ext User
 
Join Date: May 2007
Posts: 45
hui2008 is on a distinguished road
Default how to write the '-' in php items

In the js I can write like this:

Quote:
header = Ext.extend(Ext.Toolbar,{
items:['-',{text:'tool1','-',{text:'tool2'}]
});
Ext.reg('headers',header);
now I can't the '-'

Quote:
$head = array();
$head[] = array(
'-',///???????? how to do write this?
"text"=>"tool1"
);
$head[] = array(
"text"=>"menu2"
);
who can help me?
Reply With Quote
  #2  
Old 06-30-2008, 11:12 AM
devnull devnull is offline
Ext JS - Support Team
 
Join Date: Jul 2007
Posts: 3,128
devnull is on a distinguished road
Default

besides this not being a php forum, i dont see why that wouldnt work...
Reply With Quote
  #3  
Old 06-30-2008, 05:06 PM
troy.mccabe troy.mccabe is offline
Ext JS Premium Member
 
Join Date: Oct 2007
Posts: 9
troy.mccabe is on a distinguished road
Default

Look at the json_encode() of that:
[{"0":"-","text":"tool1"},{"text":"menu2"}]

You need:
["-",{"text":"tool1"},"-",{"text":"menu2"}]

Here's the code you need. Put the '-' as the first string in the array, before you make the other objects.

$head = array();
$head[] = "-";
$head[] = array("text"=>"tool1");
$head[] = "-";
$head[] = array("text"=>"menu2"); 

echo 
json_encode($head); 
if I was understanding you correctly...the Javascript provided was missing a curly brace, so I'm assuming you wanted to two objects in the array...

Let me know if you need anything else.

Edit: You might need an extra set of quotes to make ext see the -'s as strings...fyi.
Reply With Quote
  #4  
Old 06-30-2008, 09:01 PM
hui2008 hui2008 is offline
Ext User
 
Join Date: May 2007
Posts: 45
hui2008 is on a distinguished road
Thumbs up

Thank you very much!
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 09:56 PM.

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